Overhead gui displaying other player's leaderstats Value

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!

Use the OnServerEvent event out of them.

event.OnServerEvent:Connect(function(plr, character)
    character:WaitForChild("Head").LevelGui.Text = "LEVEL: "..plr.leaderstats.LEVEL.Value
end)

And in the local script,

target:GetPropertyChangedSignal("Value"):Connect(function()
    event:FireServer(plr.Character)
end)
2 Likes

Thank u a lot! It works perfectly now. Have a nice day!

1 Like