im creating a rpg called BaconRPG im using a startercharacter that changes you into a bacon hair, if that changes anything
heres the script i made, btw i dont know how to do anything with scripting
local lvl = script.Parent.Parent.Parent.Parent.Parent.leaderstats.lvl local player = game.Players.LocalPlayer local char = player.Character char.Humanoid.MaxHealth = 100 +(lvl * 10) char.Humanoid.Health = 100 +(lvl * 10)
You have to write lvl.Value and not just lvl:
local lvl = script.Parent.Parent.Parent.Parent.Parent.leaderstats.lvl local player = game.Players.LocalPlayer local char = player.Character char.Humanoid.MaxHealth = 100 +(lvl.Value * 10) char.Humanoid.Health = 100 +(lvl.Value * 10)
Now this script only runs once, which is why the health isn't going up. To fix this, I would recommend adding a .Changed event that checks for any changes on the lvl value. I would also recommend doing this on a server script, preferably the script that handles creating the leaderstats.
in a server script:
game.Players.PlayerAdded:Connect(function(Player) local stats = Instance.new("Folder") stats.Name = "leaderstats" stats.Parent = Player local lvl = Instance.new("IntValue") lvl.Name = "Lvl" lvl.Parent = stats 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)
This script checks for any property change in "lvl" and if there is, adds to the the humanoid's maxhealth.
I hope this helps.