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

Why is the textLabel not changing?

Asked by 1 year ago

I am making a script that starts a timer on a text label when the player clicks start(a surfaceGUI textButton). There is only one player per server.. What is wrong?

StartButton = game.Workspace.InstructionPart.SurfaceGui.TextButton
InstructionWall = StartButton.Parent.Parent
StringValue = game.ReplicatedStorage.timer



function StartRace()
    InstructionWall.Transparency = 1
    InstructionWall.CanCollide = false
    InstructionWall.SurfaceGui.Enabled = false
    wait(2)
    InstructionWall.Transparency = 0
    InstructionWall.CanCollide =  true
    InstructionWall.SurfaceGui.Enabled = true

    for i = 1,100,1 do
        wait(1)
        StringValue.Value = i
        for k, player in pairs(game.Players:GetPlayers()) do
            local plrname = player.Name
            game.Players.player.PlayerGui.ScreenGui.Timer.Text = i
            print(player)
        end
        print(i)
    end
end


StartButton.MouseButton1Click:Connect(StartRace)


tell me if I need to include more info!!!

1 answer

Log in to vote
2
Answered by
Xapelize 2658 Moderation Voter Community Moderator
1 year ago

I think you meant:

game.Players.LocalPlayer.PlayerGui.ScreenGui.Timer.Text = i

in line 21. It's LocalPlayer not player

Ad

Answer this question