Hello, i’m trying to make an overhead gui that displays the player’s leaderstats value.
My issue is that the overhead gui is not working right. When a player’s leaderstats value changes, it changes everyone’s overhead gui to that value. Basically, when a player levels up, everyone’s overhead gui changes to their level.
Here are the scripts I made:
ServerScriptService Script:
local billGui = game.ReplicatedStorage.LevelGui
local text = billGui.Level
local event = game.ReplicatedStorage.CashChanged
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char.Humanoid.NameDisplayDistance = 0
local newOverhead = billGui:Clone()
newOverhead.Parent = char.Head
local newText = newOverhead.Level
newText.Text = "LEVEL: "…plr.leaderstats.LEVEL.Value
```
event.OnServerEvent:Connect(function(plr)
newText.Text = "LEVEL: "..plr.leaderstats.LEVEL.Value
end)
end)
```
end)
StarterGui Local Script:
local plr = game.Players.LocalPlayer
local Stats = plr:WaitForChild(“leaderstats”)
local target = Stats.LEVEL
local event = game.ReplicatedStorage.CashChanged
target:GetPropertyChangedSignal(“Value”):Connect(function()
event:FireServer(plr)
end)
If u could help that would mean a lot! Thank u!