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

Twinkling lights ?

while true do
	script.Parent.Twinkling.Enabled = true math.random(0.5,1,2)
	wait()
	script.Parent.Twinkling.Enabled = false math.random(0.6,2,3)
end

Basically should just turn off randomly where math.rad numbers are all it does is just spam flash really quickly how i do it ? ;-;

2 answers

✓ Accepted answer

Try using a table,

local table = {true, false}
while true do
    script.Parent.Twinkling.Enabled = table[math.random(1,2)]
    wait()
    script.Parent.Twinkling.Enabled = table[math.random(1,2)]
end
The script just gets a random value from the table, true or false.

I would also suggest making the wait longer.

Good Luck!

If I helped, please don't forget to accept my answer.

I think you're mistaken a bit. That code would error instantly, as it would not work. I don't believe you're trying to set your light's brightness using radians, but instead you mean math.random(). Try this:

math.randomseed(tick()
spawn(function()
	while true do
		script.Parent.Twinkling.Enabled = true
		script.Parent.Twinkling.Brightness = math.random(0.5, 1.2)
		wait(0.1)
		script.Parent.Twinkling.Brightness = math.random(0.6, 2.3)
	end
end)

1 comment

0

i dont need brightnes... i need enabling true to false randomly between seconds... -.-

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