Obby checkpoint text not changing

Hello! I am making an obby with checkpoints. I have a text label that is supposed to be the same as the leaderstats. But it is not working.

Script in checkpoints:

local Checkpoint = script.Parent
local player
Checkpoint.Touched:Connect(function(hit)
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		player = game.Players:WaitForChild(hit.Parent.Name)
		if player.leaderstats.Stage.Value +1 == Checkpoint.StageNum.Value then
			player.leaderstats.Stage.Value += 1
			wait(0.1)
			game.ReplicatedStorage.Remotes.CheckpointRemote:FireClient(player)
		end
	end
end)

Localscript in starter gui:

local plr = game.Players.LocalPlayer
local currentStage = plr.leaderstats.Stage.Value
local textThing = plr.PlayerGui.Interface.Frame.Level.Level

textThing.Text = tostring(currentStage)

game.ReplicatedStorage.Remotes.CheckpointRemote.OnClientEvent:Connect(function(player)
	textThing.Text = tostring(currentStage)
end)

in such a way the variable stores initial value of plr.leaderstats.Stage so whenever the server fires client the text is being changed to constant value
to fix that remove .Value from the variable and put it inside tostring

textThing.Text = tostring(currentStage.Value)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.