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

IntValues don't work with this script? This is frustrating?

if game.Workspace.Clock.Value == 3 then
	script.Parent.Image = "http://www.roblox.com/asset/?id=166903827"
	game.Lighting.NightScript:clone().Parent = script.Parent.Parent.NightTime
script.Parent.Parent.NightTime.BackgroundColor3 = script.Parent.Parent.DayTime.BackgroundColor3
end

Why won't this work?

1 comment

0

I can't see nothing wrong. Are all the paths right? Any output?

1 answer

✓ Accepted answer

Remember: If statements only run once.

I may be wrong, but if your goal is to do that code whenever Clock's value == 3, then it will not work. If statements only run once. If Clock's value is not three the first time the if statement runs, even if it equals 3 later, your code will not execute. To fix this, use the Changed event.

game.Workspace.Clock.Changed:connect(function()
	if game.Workspace.Clock.Value == 3 then
		script.Parent.Image = "http://www.roblox.com/asset/?id=166903827"
		game.Lighting.NightScript:clone().Parent = script.Parent.Parent.NightTime
		script.Parent.Parent.NightTime.BackgroundColor3 = 
		script.Parent.Parent.DayTime.BackgroundColor3
	end
end)

Other than that, I don't know. Like Tesouro said, make sure all your paths are correct, and include any output.

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