Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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 comment

1

Thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.