I have made a game where you need to climb, I wanted to add a leaderboard who show the height of each players in the game, so I made a script with tutorials (I'm not very good :P) it works for one player but not for everyone. I have already asked a question about this but it didn't help me or almost : I learnt that i needed to use RemoteEvent but i can't find how to make my leaderboard work!
Here is the scripts :
It's a Regular Script in ServerScriptService :
local function OnPlayerJoin(player)
repeat wait() until player.Character
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Height = Instance.new("IntValue")
Height.Name = "Height"
Height.Parent = leaderstats
game.ReplicatedStorage.RemoteEvent1:FireClient(player)
end
game.Players.PlayerAdded:Connect(OnPlayerJoin)
And this is a LocalScript in StarterGui :
local function HeightCalc(player)
repeat wait() until player.Character
while true do
for i, player in pairs(game.Players:GetPlayers()) do
local char = player.Character
if char:FindFirstChild("HumanoidRootPart") then
local Height = player.leaderstats.Height
Height.Value = (player.Character.HumanoidRootPart.Position.Y - 8)
end
end
end
end
game.ReplicatedStorage.RemoteEvent1.OnClientEvent:Connect(HeightCalc)
Thank you in advance!
