Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Create a new Leaderstats object
- local leaderstats = Instance.new("Folder")
- leaderstats.Name = "Leaderstats"
- leaderstats.Parent = game:GetService("ServerScriptService")
- -- Create a new "Points" stat
- local points = Instance.new("IntValue")
- points.Name = "Points"
- points.Parent = leaderstats
- points.Value = 0
- -- Create a function to add points to the stat
- function addPoints(player, amount)
- local playerStats = player:FindFirstChild("leaderstats")
- if playerStats then
- local points = playerStats:FindFirstChild("Points")
- if points then
- points.Value = points.Value + amount
- end
- end
- end
- -- Connect the function to a player's "CharacterAdded" event
- game.Players.PlayerAdded:Connect(function(player)
- player.CharacterAdded:Connect(function(character)
- addPoints(player, 10)
- end)
- end)
Add Comment
Please, Sign In to add comment