✓ Accepted answer
When you spawn a script is created in the character called "Health" which is where the players health regeneration is done.
There are multiple ways of doing this but the way I would do this is to delete the Health script when the character spawns.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(charModel)
charModel:WaitForChild('Health'):Destroy()
end)
end)
We can then check the players level ect then connect a new function which will be similar to the Heath script.
This is just an example server script
local function healthRegen(incAmount, hum)
local deb = false
return function()
if deb then return end
deb = true
hum.Health = math.min(hum.MaxHealth, hum.Health + (incAmount * wait(1))
deb = false
end
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(charModel)
charModel:WaitForChild('Health'):Destroy()
local hum = charModel:WaitForChild('Humanoid')
if [ check the players level here] then
hum.HealthChanged:Connect(healthRegen([some value], hum))
end
end)
end)
I hope this helps, please comment if you do not understand how / why this script works.
1 comment
I personally think yours is over-complicated. But then again we all script in our own way. It's just so long lol