Score
unknown
lua
a year ago
1.3 kB
3
Indexable
--применять к ServerScriptService local Players = game:GetService("Players") local function onCharacterAdded(character, player) player:SetAttribute("IsAlive", true) local humanoid = character:WaitForChild("Humanoid") humanoid.Died:Connect(function() local points = player.leaderstats.Points points.Value = 0 player:SetAttribute("IsAlive", false) end) end local function onPlayerAdd(player) local leaderboard = Instance.new("Folder") leaderboard.Name = "leaderstats" leaderboard.Parent = player local points = Instance.new("IntValue") points.Name = "Points" points.Value = 0 points.Parent = leaderboard player:SetAttribute("IsAlive", false) player.CharacterAdded:Connect(function(character) onCharacterAdded(character, player) end) end Players.PlayerAdded:Connect(onPlayerAdd) while true do wait(1) local playerlist = Players:GetPlayers() for currentPlayer = 1, #playerlist do print(currentPlayer) local player = playerlist[currentPlayer] if player:GetAttribute("IsAlive") then local points = player.leaderstats.Points points.Value = points.Value+1 end end end
Editor is loading...
Leave a Comment