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)