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

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

Asked by 9 years ago
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?

0
I can't see nothing wrong. Are all the paths right? Any output? Tesouro 407 — 9y

1 answer

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
9 years ago

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.

Ad

Answer this question