Help needed, Leaderboard Cash

I should not be offsetted because I did nothing to it.

Also a blue outline appears showing it’s not

Instead of making new TextLabel and making it hard to read try this way:

Make new ScreenGui
image

Then Insert ScrollingFrame

Then Scale it And change the colors and everything.

Now set CanvasSize to {0, 0},{0, 0} then change AutomaticCanvasSize to Y
image

Now insert UIGridLayout to scrollingframe and change CellSize to {1, 0},{0.1, 0} and Cellpadding to {0, 0},{0, 0}
it will look somethinglike this:

Then insert new Folder under screengui, Then insert TextLabel and make sure it’s invisible.
image

Now i did these steps to prevent doing useless code.

Now for coding part you can do that automatically.

Insert Local Script inside ScreenGui.
And write with me:

local Players = game:GetService("Players") -- getting players

local ScreenGui = script.Parent -- Getting ScreenGui
local Folder = ScreenGui.NeedToCopy -- Getting Folder need to copy
local ScrollingFrame = ScreenGui.ScrollingFrame -- Getting Scroling frame

Players.PlayerAdded:Connect(function(Player) -- fire when new player added  
	local Cash = Player:WaitForChild("Cash") -- Getting cash from player
	Cash:GetPropertyChangedSignal("Value"):Wait() -- Waiting for cash value to load
	local NewTextLabel = Folder.Player:Clone() -- copy new textlabel
	NewTextLabel.Parent = ScrollingFrame -- moving new textlabel to scrolling frame
	NewTextLabel.Visible = true -- Make it visible
	NewTextLabel.Name = Player.Name -- Naming it to player name
	NewTextLabel.Text = Player.Name.."$"..Cash.Value -- Changing text
	Cash:GetPropertyChangedSignal("Value"):Connect(function(Value) -- when the cash changed fires this function
		NewTextLabel.Text = Player.Name.."$"..Cash.Value -- Changing Text
	end)
end)

Players.PlayerRemoving:Connect(function(Player) -- When player leaving fires this function
	if ScrollingFrame:FindFirstChild(Player.Name) then -- Checking if textlabel exist
		ScrollingFrame:FindFirstChild(Player.Name):Destroy() -- Delete textlabel if player left
	end
end)

Anyerrors feel free to tell me because i made it without testing it. :heart:

The cash number is the same for all players because u get the cash value from one player and then all the texts are the same value, in the cash.Changed u should change this:

for _, plr in game.Players:GetPlayers() do
If plr.Name == CurrentPlayers.Name then
PlayerName.Text = CurrentPlayer.Name … " $” … (plr:WaitForChild("leaderstats").Cash.Value)
end
end
1 Like