Created
July 18, 2024 18:20
-
-
Save ohusq/d74a916b8dba03cda26a9ebd8ef6d3f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
players.PlayerAdded:Connect(function(player) | |
local data = db:getDataForInstance(player.UserId) | |
local leaderstats = Instance.new("Folder", player) | |
leaderstats.Name = "leaderstats" | |
local kills = Instance.new("IntValue", leaderstats) | |
kills.Name = "Kills" | |
kills.Value = data.Kills | |
local deaths = Instance.new("IntValue", leaderstats) | |
deaths.Name = "Deaths" | |
deaths.Value = data.Deaths | |
player.CharacterRemoving:Connect(function(character: Model) | |
local humanoid = character:FindFirstChild("Humanoid") | |
if humanoid then | |
if humanoid:GetState() == Enum.HumanoidStateType.Dead then | |
print(`{player.Name} has died`) | |
end | |
end | |
end) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment