Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My script is not working. Where is the mistake? Is it because of randomseed?

Asked by 4 years ago

Here is my script

while true do
local Plank = script.Parent
math.randomseed(os.time())
local function reset()
    local random = math.random(0,1)
if random == 0 then
    Plank.CanCollide = true
elseif random == 1 then
    Plank.CanCollide = false
end
end
wait(180)
reset()
end

everything seems to be fine here but it still doesn’t work

1 answer

Log in to vote
0
Answered by 4 years ago

it might work now.

math.randomseed(tick())
local Plank = script.Parent
function reset()
    local random = math.random(0,1)
    if random == 0 then
        Plank.CanCollide = true
    else
        Plank.CanCollide = false
    end
end
while true do
    wait(180)
    reset()
end

Make sure to accept this answer if it works.

1
Thanks anton5808 -6 — 4y
Ad

Answer this question