Stage GUI for Obby

Hi, so I wanted to create a GUI to tell players which stage they are on in my obby. I put this script in a local script that’s in the text label that I want it to be shown in. For some reason its not working.

local plr = game.Players.LocalPlayer
local playerStage = plr.Stage
local textDisplay = script.Parent.TextLabel

textDisplay.Text = playerStage.Value

playerStage.Changed:Connect(function(newValue)
	textDisplay.Text = playerStage.Value
end)

If anyone can please help it would be greatly appreciated.
Thank You

3 Likes

Please tell us if there are any errors.

1 Like

This is what it says when I run the script "Stage is not a valid member of Player “Players.Barcena1089”

Is there another script that adds “Stage” inside the player?

Try adding local stage = plr:WaitForChild(“Stage”)

This is what it says when I add that "Infinite yield possible on 'Players.Barcena1089:WaitForChild(“Stage”)

Check your workspace that means plr.Stage doesn’t exist.

Try plr.leaderstats:WaitForChild(“Stage”)

Is it possible that Stage is part of leaderstats? If so then try

plr.leaderstats:WaitForChild('Stage')

No I don’t think so. Can you tell me how and where to add it?

Yes stage is actually apart of leaderdstats. I am going to try that now.

Do I add that as a variable or apart of the script?

Just replace it with what you currently have playerStage defined as

local plr = game:GetService('Players').LocalPlayer -- obtain all services with GetService
local playerStage = plr.leaderstats:WaitForChild('Stage')
local textDisplay = script.Parent.TextLabel

textDisplay.Text = playerStage.Value

playerStage:GetPropertyChangedSignal('Value'):Connect(function() -- GetPropertyChangedSignal is a better way to handle these changes
	textDisplay.Text = playerStage.Value
end)
2 Likes