Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
ghxstlvty 133
4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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!

0
I don't understand where the location is that your putting that script. ghxstlvty 133 — 4y
0
This is how I have it setup. https://prnt.sc/r9ix8y ghxstlvty 133 — 4y
0
Alright, I'll adjust the script. killerbrenden 1537 — 4y
0
Alright, put a ServerScript inside of the Frame that holds the 3 TextLabels, and put what I have written above into the script. killerbrenden 1537 — 4y
View all comments (12 more)
0
Thanks, I'll try it out. ghxstlvty 133 — 4y
0
Didn't work. :/ ghxstlvty 133 — 4y
0
How did you set it up again, but with the script? killerbrenden 1537 — 4y
0
https://prnt.sc/r9k0st Note: I didn't edit the script at all. ghxstlvty 133 — 4y
0
Is the Billboard GUI located inside the head of the player? killerbrenden 1537 — 4y
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. ghxstlvty 133 — 4y
0
Alright, I think I fixed it. killerbrenden 1537 — 4y
0
Alrighty, I'll try it out, thanks!! ghxstlvty 133 — 4y
0
No problem! killerbrenden 1537 — 4y
0
It worked!!! Thank you so much! ghxstlvty 133 — 4y
0
No problemo! killerbrenden 1537 — 4y
Ad

Answer this question