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

Change leaderstats to update a billboardGUI script not working. Any help?

Salutations, I need help finding the error in this script.

local GUI = game.ServerScriptService.RankHandler.Rank.Frame.Points
local leaderstats = "Points"
local Points = leaderstats:WaitForChild("Points")

Points.Value:GetPropertyChangedSignal("Value"):Connect(function() -- When the Points changes then fire the event.
    GUI.Text = Points.Value -- Set the Gui Text to the Value of the Points.
end)

The user gets points for getting things correct during the training.

I want the BillboardGUI to change when the Leaderstat is changed.

1 answer

✓ Accepted answer

This is how I set up mine.

Hierarchy

ServerScript in ServerScriptService

game.Players.PlayerAdded:Connect(function(player)	
	local ls = Instance.new("Folder",player)
	ls.Name = "leaderstats"
	
	local points = Instance.new("IntValue",ls)
	points.Name = "Points"
	
	local character = player.Character or player.CharacterAdded:Wait()
	
	local ohg = game:GetService("ReplicatedStorage"):WaitForChild("BillboardGui"):Clone()
	ohg.Parent = character.Head
end)

ServerScript inside of Frame

wait(1)

local char = script.Parent.Parent.Parent
local player = game:GetService("Players"):GetPlayerFromCharacter(char)
local points = player:WaitForChild("leaderstats"):FindFirstChild("Points")

points:GetPropertyChangedSignal("Value"):Connect(function(value)
	script.Parent.TextLabel.Text = points.Value
end)

Hope this helped!

16 comments

0

I don't understand where the location is that your putting that script.

0

This is how I have it setup. https://prnt.sc/r9ix8y

0

Alright, I'll adjust the script.

0

Alright, put a ServerScript inside of the Frame that holds the 3 TextLabels, and put what I have written above into the script.

0

Thanks, I'll try it out.

0

Didn't work. :/

0

How did you set it up again, but with the script?

0

https://prnt.sc/r9k0st Note: I didn't edit the script at all.

0

Is the Billboard GUI located inside the head of the player?

0

When I play the game in studio, then go to my avatar in workspace it isn't parented to head, it is just parented to my char.

0

Alright, I think I fixed it.

0

Alrighty, I'll try it out, thanks!!

0

No problem!

0

It worked!!! Thank you so much!

0

No problemo!

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