game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local level = Instance.new("IntValue")
level.Name = "Level"
level.Value = 1
level.Parent = leaderstats
local xp = Instance.new("IntValue")
xp.Name = "XP"
xp.Value = 0
xp.Parent = leaderstats
end)local part = script.Parent
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
player.leaderstats.XP.Value += 10
end
end)local xpNeeded = 100
game.Players.PlayerAdded:Connect(function(player)
local xp = player.leaderstats.XP
local level = player.leaderstats.Level
xp.Changed:Connect(function()
if xp.Value >= xpNeeded then
xp.Value = 0
level.Value += 1
end
end)
end)