Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local pointPart1 = game.Workspace.PointsPlaceFolder.PointPart1
- 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 onPlayerAdded(player)
- local leaderstats = Instance.new("Folder")
- leaderstats.Name = "leaderstats"
- leaderstats.Parent = player
- local points = Instance.new("IntValue")
- points.Name = "Points"
- points.Value = 0
- points.Parent = leaderstats
- player:SetAttribute("IsAlive", false)
- player.CharacterAdded:Connect(function(character)
- onCharacterAdded(character, player)
- end)
- end
- Players.PlayerAdded:Connect(onPlayerAdded)
- while true do
- task.wait(1)
- local playerList = Players:GetPlayers()
- for currentPlayer = 1, #playerList do
- local player = playerList[currentPlayer]
- if player:GetAttribute("IsAlive") then
- local points = player.leaderstats.Points
- if pointPart1.Touched then
- points.Value = points.Value + 10
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement