I’m making a custom leaderboard ui and I got all the scripting done but the username/kills/death display does not show.
In studio
While playing
Code
local scoreboard = script.Parent
local main = scoreboard.BG
local holder = main.StatsHold
local temp = holder.Template
temp.Parent = script
local UIS = game:GetService("UserInputService")
local function clear()
for i,v in pairs(holder:GetChildren()) do
if v:IsA("Frame") then
v:Destroy()
end
end
end
local function generate()
for i,player in pairs(game.Players:GetPlayers()) do
local PS = player:FindFirstChild("PlayerStats")
local kills = PS.kills
local deaths = PS.deaths
local c = temp:Clone()
c.user.Text = player.Name
c.kills.Text = kills.Value
c.deaths.Text = deaths.Value
c.Parent = holder
end
end
----Edit "Tab" to custom keybind----
UIS.InputBegan:Connect(function(input, k)
if input.KeyCode == Enum.KeyCode.Tab then
scoreboard.Enabled = true
generate()
end
end)
UIS.InputEnded:Connect(function(input, k)
if input.KeyCode == Enum.KeyCode.Tab then
scoreboard.Enabled = false
end
end)
I don’t think it was a code problem because i deleted everything except the keycode and it still didn’t show. If any more screenshots are needed I can provide them for you.
Edit: I deleted temp.Parent = script
and it showed but now the stats changer doesn’t work.