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

recolor script won't work, help please?

Asked by 9 years ago

it wont recolor the CompLights after the value became true (that happend with another script and I tested it, that worked perfect) can someone help me?

System = game.Workspace.System
AlertV = System.AlertV

if AlertV.Value == true then
    for i, v in pairs(game.Workspace:GetChildren()) do 
        if v.Name == 'CompLight' then
        v.BrickColor = BrickColor.new('Really red')
    end
end

while true do
    Current = game.Workspace.System.Temperature
    CurrentV = game.Workspace.System.Temperature.Value
    SysON = game.Workspace.System.SysON
    function NewText()
    game.Workspace.MasterScreen.MasterScreen.Gui.Frame.Temp.Text = ""..CurrentV.." C"
    end
    NewText()

    if SysON.Value == true then
    wait(5)
    Current.Value = Current.Value  + 2
    end
    NewText()

    if Current.Value == 1200 then
    game.Workspace.System.AlertV.Value = true
    end

end 

1 answer

Log in to vote
1
Answered by 9 years ago

Is this the whole script? The script doesn't loop or contain a function or anything, so when it is inserted into the Workspace (or wherever it's supposed to go to) it will only run once. To fix this, you can try creating a loop that checks whether or not AlertV.Value == true. Also, it appears you're missing an end in the script.

System = game.Workspace.System
AlertV = System.AlertV

while wait() do
    if AlertV.Value == true then
        for i, v in pairs(game.Workspace:GetChildren()) do 
            if v.Name == 'CompLight' then
                v.BrickColor = BrickColor.new('Really red')
            end
        end
    end
end

Note that this script will constantly run and recolor CompLight. If this is a problem, you can try breaking the loop. I hope this helped!

0
I'm gonna test this now! GreyLuca 30 — 9y
0
it didn't work, after the value AlertV became true nothing happend at the lights... it are like 40 lights btw GreyLuca 30 — 9y
0
That's odd, when I tested it out, the script ran just fine... Have you tried deleting and re-inserting the script into Workspace? IcyArticunoX 355 — 9y
0
not yet, I will try that GreyLuca 30 — 9y
View all comments (3 more)
0
it didn't work... I added the script that changes the value also, but that just works... GreyLuca 30 — 9y
0
oh it worked! GreyLuca 30 — 9y
0
Great! If you found my answer helpful, you can accept the answer and upvote. IcyArticunoX 355 — 9y
Ad

Answer this question