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

Whenever I change the value, it never changes to the other part of the script!?

Asked by 4 years ago
Edited 4 years ago

FirstImage = "http://www.roblox.com/asset?id=2967292661" SecondImage = "http://www.roblox.com/asset?id=2967293159" ThirdImage = "http://www.roblox.com/asset/?id=2972903107" if game.ReplicatedStorage.CheckIn1.Value == false then while true do game.Workspace.CheckIn1.SurfaceGui.ImageLabel.Image = FirstImage wait(4) game.Workspace.CheckIn1.SurfaceGui.ImageLabel.Image = SecondImage wait(4) end elseif game.ReplicatedStorage.CheckIn1.Value == true then while true do game.Workspace.CheckIn1.SurfaceGui.ImageLabel.Image = FirstImage wait(4) game.Workspace.CheckIn1.SurfaceGui.ImageLabel.Image = ThirdImage wait(7) end end

I am trying to make it so if I sees the value changes it changes the script

0
Maybe you should add the "while true do" at line 06 to line 05 and line 05 at line 06. TheRealPotatoChips 793 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

You probably intended to have the loop outside the conditional, so that it's checked periodically, no? Like this:

FirstImage = "http://www.roblox.com/asset?id=2967292661" 
SecondImage = "http://www.roblox.com/asset?id=2967293159" 
ThirdImage = "http://www.roblox.com/asset/?id=2972903107"

while true do
    if game.ReplicatedStorage.CheckIn1.Value == false then    
        game.Workspace.CheckIn1.SurfaceGui.ImageLabel.Image = FirstImage
        wait(4)
        game.Workspace.CheckIn1.SurfaceGui.ImageLabel.Image = SecondImage
        wait(4) 
    elseif game.ReplicatedStorage.CheckIn1.Value == true then
         game.Workspace.CheckIn1.SurfaceGui.ImageLabel.Image = FirstImage   
        wait(4) 
        game.Workspace.CheckIn1.SurfaceGui.ImageLabel.Image = ThirdImage    
        wait(7) 
    end
wait()
end 

BUT, just FYI...

Value object changes don't replicate from client to server, so if this is a server script, the only way you can change the Value of CheckIn1 for everyone to see is from a server script or the developer console command line (F9 console). If you set it from a LocalScript, only that player's client will see things change. I mention this because having your ValueObject in ReplicatedStorage suggests you might be trying to use it to replicate a change from client to server, which will not work. You need a RemoteEvent or RemoteFunction to set it from a client and have it change on the server.

0
Thank you so much! DennisSense 23 — 4y
Ad

Answer this question