RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a combat system"
-- server script local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local function onPlayerAdded(player) local character = player.Character local humanoid = character:WaitForChild("Humanoid") local function onCharacterDied() local killer = humanoid.LastDamage.Attacker if killer then killer.leaderstats.Kills.Value = killer.leaderstats.Kills.Value + 1 end player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1 end humanoid.Died:Connect(onCharacterDied) end Players.PlayerAdded:Connect(onPlayerAdded)