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

How do I make my script change a Gui's colour and start a timer?

Asked by
pwnd64 106
9 years ago

Hi, I'm trying to make stepping on a block recolour a Gui and then change a value to true, and then when all three blocks have been stepped on it will begin a timer. This is my code so far-

timer=1
totaltimer=1
ValueA = game.Workspace.PartA.ValueA.Value
ValueB = game.Workspace.PartB.ValueB.Value
ValueC = game.Workspace.PartC.ValueC.Value
if ValueA == true and ValueB == true and ValueC == true then
repeat
wait(1)
timer = timer + 1
until
timer > 300
if ValueA==false or ValueB==false or ValueC==false then
    timer=totaltimer
end
game.Lighting.RaidersWin:Clone().Parent = game.Players.LocalPlayer.PlayerGui
for i, player in ipairs(game.Players:GetPlayers()) do
    if player.Character then
        local hum = player.Character:FindFirstChild('Humanoid')
        if hum then
            hum.Health = 0
            timer=totaltimer
            ValueA=false
            ValueB=false
            ValueC=false
            game.Workspace.PartA.BrickColor.new="Earth green"
            game.Workspace.PartB.BrickColor.new="Earth green"
            game.Workspace.PartC.BrickColor.new="Earth green"
        end
    end
end
end

and

ValueA = game.Workspace.PartA.ValueA.Value
ValueB = game.Workspace.PartB.ValueB.Value
ValueC = game.Workspace.PartC.ValueC.Value
timer=1
totaltimer=1
if ValueA == true then
    repeat
        wait()
    game.StarterGui.Points.Frame.Frame.TextLabelA.BackgroundColor3 = Color3.new(170, 0, 0)
    until ValueA == false
end
if ValueB == true then
    repeat
        wait()
    game.StarterGui.Points.Frame.Frame.TextLabelB.BackgroundColor3 = Color3.new(170, 0, 0)
    until ValueB == false
end
if ValueC == true then
    repeat
        wait()
    game.StarterGui.Points.Frame.Frame.TextLabelC.BackgroundColor3 = Color3.new(170, 0, 0)
    until ValueC == false
end
if ValueA==true and ValueB==true and ValueC==true then
    repeat
        game.StarterGui.Points.Frame.Visible=true
        wait(1)
        timer=timer+1
    until
    timer > 300
end

For some reason the Gui will not change colour and it will not make a hidden gui show. Sorry for the messy code, I'm just learning. Thanks for stopping by!

Answer this question