this is my script

game.Players.PlayerAdded:Connect(function(plr)
	
	local stats = Instance.new("IntValue",plr)
	stats.Name = "leaderstats"
	
	local Gold = Instance.new("IntValue",stats)
	Gold.Name = "Gold"
	Gold.Value = 0
	 
	local XP = Instance.new("IntValue",stats)
	XP.Name = "XP"
	XP.Value = 0
	
	local lvl = Instance.new("IntValue",stats)
	lvl.Name = "lvl"
	lvl.Value = 0

		XP.Changed:connect(function()
		lvl.Value = math.floor(XP.Value/100)
		
    lvl.Changed:Connect(function()
        local char = Player.Character or Player.CharacterAdded:wait()
        local Humanoid = char:WaitForChild("Humanoid")
        Humanoid.MaxHealth = 100 + (lvl.Value * 10)
        Humanoid.Health = Humanoid.MaxHealth
    end)
end)
		
	end)

3 comments

0

Uh, what happen when the script run? We can't help you because we don't know what is your problem.

0

well it makes the leaderstats and makes me lvl up when i get 100 XP but i want it to give me more health but that isnt working

0

Use :GetPropertyChangedSignal() instead of Changed. The function will fire Changed event for specific Property https://developer.roblox.com/api-reference/function/Instance/GetPropertyChangedSignal