RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a level system with xp that changes players health and the damage of the players weapon"
-- script for adding XP local Players = game:GetService("Players") function addXP(player, amount) local stats = player:WaitForChild("leaderstats") local xp = stats:WaitForChild("XP") xp.Value = xp.Value + amount end Players.PlayerAdded:Connect(function(player) local stats = Instance.new("Folder") stats.Name = "leaderstats" stats.Parent = player local xp = Instance.new("IntValue") xp.Name = "XP" xp.Value = 0 xp.Parent = stats local level = Instance.new("IntValue") level.Name = "Level" level.Value = 1 level.Parent = stats local health = Instance.new("IntValue") health.Name = "Health" health.Value = 100 health.Parent = stats local damage = Instance.new("IntValue") damage.Name = "Damage" damage.Value = 10 damage.Parent = stats end) -- script for updating levels, health, and damage local Players = game:GetService("Players") function updateStats(player) local stats = player:WaitForChild("leaderstats") local xp = stats:WaitForChild("XP") local level = stats:WaitForChild("Level") local health = stats:WaitForChild("Health") local damage = stats:WaitForChild("Damage") while true do wait(1) if xp.Value >= (level.Value * 100) then level.Value = level.Value + 1 health.Value = 100 + (level.Value * 10) damage.Value = 10 + (level.Value * 2) player.Character.Humanoid.MaxHealth = health.Value player.Character.Humanoid.Health = health.Value end end end Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function() updateStats(player) end) end)