https://pastebin.com/vPgjPdnK
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 i = 1, #playerList do
local player = playerList[i]
if player:GetAttribute("IsAlive") then
local points = player.leaderstats.Points
points.Value += 1
end
end
end
I tried adding a another function that basically onTouch it will cause 10 points to gain and then breaks. I have conceptual issues so it may have not accurately been carried out but there were no error/syntax’s.
New contributor
Maximus Ekon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.