Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why is the textLabel not changing?

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

I think you meant:

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

in line 21. It's LocalPlayer not player

This discussion is preserved as it was. New answers, comments, and votes are closed.