So i want to make an arsenal similar system where if someone kills you see who has the most kills.
I tried to make an int number to the player but i have no idea how to sort it and i need some help
like that
here is the script that i tried:
local Timer = game.ReplicatedStorage.Events.RoundEvents:WaitForChild("Timer")
local InRound = game.ReplicatedStorage.Round:WaitForChild("InRound") -- BoolValue from Round
local KillEvent = game.ReplicatedStorage.Events.FPS:WaitForChild("KillEvent")
local Playertable = {}
InRound.Changed:Connect(function(Val)
if Val == true then
print("round start")
elseif Val == false then
print("round over")
table.clear(Playertable)
local players = game.Players
for i, v in players:GetChildren() do
for i, e in v:GetChildren() do
if e.Name == "Kills" then
e.Value = 0
end
end
end
end
end)
game.Players.PlayerAdded:Connect(function(plr)
local Kills = Instance.new("IntValue")
Kills.Name = "Kills"
Kills.Parent = plr
Kills.Value = 0
end)
KillEvent.Event:Connect(function(plr)
if InRound.Value == true then
local Kills = plr.Kills
Kills.Value += 1
print(Kills.Value)
end
end)