so i have this Script That Shows The Players Kills, I also dont want to Save the players Kills but it Dosent Really For Some Reason, i also cant see any Errors too, oof
This is the Script
local MatchFolder = "MatchFolder"
local MatchKIlls = "MatchKIlls"
script.Parent.PlayerFrame.Wins.Text = "MatchKIlls"
function CreateGui()
return script.Parent.PlayerFrame:Clone()
end
function GetTopPlayers()
local TopPlayers={}
local Numbers={}
local PossiblePlayers={}
local function GetPlayerWins(Player)
if Player and Player:FindFirstChild(MatchFolder) and Player.MatchFolder:FindFirstChild(MatchKIlls) then
return Player.MatchFolder.MatchKIlls.Value
end
return 0
end
for i,v in pairs(game.Players:GetPlayers()) do
table.insert(Numbers,GetPlayerWins(v))
table.insert(PossiblePlayers,v)
end
local function GetBiggest()
local Biggest=math.max(unpack(Numbers))
local Player
for index,value in pairs(PossiblePlayers) do
if Biggest == GetPlayerWins(value) then
Player = value
table.remove(PossiblePlayers,index)
break
end
end
for i,v in pairs(Numbers) do
if v==Biggest then
print("Removed: "..v.." "..Numbers[i])
table.remove(Numbers,i)
break
end
end
return Player
end
for i = 1,#game.Players:GetPlayers() do
local Biggest = GetBiggest()
table.insert(TopPlayers,i,Biggest)
end
return TopPlayers
end
function UpdateGui()
local TopPlayers = GetTopPlayers()
local function ClearGuis()
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "Player" then v:Destroy() end
end
end
ClearGuis()
if #TopPlayers>0 then
for i,v in pairs(TopPlayers) do
if i>10 then
break
end
pcall(function()
local Frame=CreateGui()
Frame.BackgroundColor3 = Color3.new(1,1,1)
Frame.Name = "Player"
Frame.Parent = script.Parent
Frame.Position = UDim2.new(0.05,0,i * .08,0)
Frame.PlayerName.Text = v.Name
Frame.Place.Text = i
Frame.Wins.Text = tostring(v.MatchFolder.MatchKIlls.Value)
end)
end
end
end
game.Players.PlayerAdded:connect(function(Player)
UpdateGui()
Player:WaitForChild(MatchFolder):WaitForChild(MatchKIlls).Changed:connect(function()
UpdateGui()
end)
UpdateGui()
end)
game.Players.PlayerRemoving:connect(function(Player)
UpdateGui()
end)