of     1   

e6_4KOkGsp
#220785664Saturday, July 08, 2017 12:17 PM GMT

So in my game, there's an area called the maze. There are walls all over the place, and a script decides randomly with math.random tick if they are there or not. The current script for the variable "visible" is; visible = math.random(2) If it's equal to one, then it's visible. If it's equal to 2, it's invisible. I duplicated the wall with the script to make every single wall random. However, it causes all walls to either be there or not there (All walls visible or all walls not visible). Is there any way to make the variable "visible" local to it's own script?
MonoBlockZ
#220786057Saturday, July 08, 2017 12:26 PM GMT

Can you post the whole script? And why not just do script.Parent.Transparency = math.random(0, 1) I tried using visible = math.random(2) its working prefectly
e6_4KOkGsp
#220786245Saturday, July 08, 2017 12:30 PM GMT

It's also if you can collide with it. Here's the whole script: while true do math.randomseed(tick()) for _ = 1, 2 do visible = math.random(2) if visible == # #### ########################## = 0 script.Parent.CanCollide = true elseif visible == # #### ########################## = 1 script.Parent.CanCollide = false end wait(1200) end end
e6_4KOkGsp
#220786663Saturday, July 08, 2017 12:37 PM GMT

It won't let me post the whole thing, it keeps censoring and glitching. Well, it's also supposed to be if the player can collide with it or not
e6_4KOkGsp
#220787007Saturday, July 08, 2017 12:45 PM GMT

What I'm looking for is how to make variables local to their own script.
MonoBlockZ
#220787302Saturday, July 08, 2017 12:51 PM GMT

Put all your maze part in one model, and put this script inside the model math.randomseed(tick()) while true do for i, v in pairs(script.Parent:GetChildren()) do if v:IsA("BasePart") then random = math.random(0,1) v.CanCollide = (random < 0.5) v.Transparency = random end end wait(1) end --Change the value inside wait() to change how fast they changed --Also be sure to delete your old script
MonoBlockZ
#220787570Saturday, July 08, 2017 12:56 PM GMT

I can't really understand your script and i don't know much about randomseed but i guess its either your put wait(1200) in the wrong place that it only changed 1 brick and waited 1200 seconds or maybe its because you put randomseed inside the loop, that it asked for different seed everytime.
cowsoncows
#220787937Saturday, July 08, 2017 1:03 PM GMT

The variables are local to their own script, it's math.random() that isn't working properly. It is giving you a random number, but it is giving the same random number everywhere. Try adding: math.randomseede(tick()) to the first line of th script.
cowsoncows
#220787948Saturday, July 08, 2017 1:03 PM GMT

*math.randomseed(tick())
e6_4KOkGsp
#220789830Saturday, July 08, 2017 1:41 PM GMT

Sorry Cowsoncows, unfortunately it's still not working.
e6_4KOkGsp
#220789907Saturday, July 08, 2017 1:42 PM GMT

Each wall has it's own script.
cowsoncows
#220790019Saturday, July 08, 2017 1:44 PM GMT

Actually, maybe math.randomseed(tick()) is the problem. tick() gives unix time (time elapsed since january 1st 1970) so if every script calls it at the same time, every script is getting the same seed thus has the same output for math.random.
e6_4KOkGsp
#220793016Saturday, July 08, 2017 2:38 PM GMT

@MonoBlockZ That actually worked! Would you mind teaching me how it works?
e6_4KOkGsp
#220793160Saturday, July 08, 2017 2:41 PM GMT

Thanks for the advice from both of you! Now the maze can't be memorized by players! I really appreciate it!
braylee8
#221697211Tuesday, July 18, 2017 4:53 PM GMT

Hey, my name is Braylee was wondering, since you work for assassin(Like I saw) I want to have earth elemental. Now I know you will decline at ##### BUT! I got scammed my earth elemental was scammed. I don't know by who but all I know is.. that I miss it. And I need you're help, maybe you could just give me a hand and just Do a little of skills at hacking maybe.. And get my knife back? Please, that would mean the world to me!

    of     1