I made my own custom regen script it works in studio but in a real server it does not work i checked f9 for errors but none. it does seam to work if i disabled it and enable it is there a way to fix this this but it only works if i disable and re enable it by clicking the check box. here is both scripts i used the first 1 switches them and the second 1 is the regen script i custom made.
--script 1 player =game.Players.LocalPlayer wait() char = player.Character oldhealth = char:WaitForChild("Health") newhp = script.Health if oldhealth then oldhealth:remove() newhp.Parent = char newhp.Disabled = false script:remove() end
-- script 2 --Responsible for regening a player's humanoid's health -- declarations local player = game.Players:GetPlayerFromCharacter(script.Parent) local Figure = script.Parent local Head = Figure:WaitForChild("Head") local Humanoid = Figure:WaitForChild("Humanoid") local mr = player:WaitForChild("MaxRegen") if mr then print("MaxRegen Found") end local regening = false -- regeneration function regenHealth() if regening then return end regening = true while Humanoid.Health < Humanoid.MaxHealth do wait(0.3) local health = Humanoid.Health if health > 0 and health < Humanoid.MaxHealth and Humanoid.MaxHealth <=100 then health = health + mr.Value Humanoid.Health = health end end if Humanoid.Health > Humanoid.MaxHealth then Humanoid.Health = Humanoid.MaxHealth end regening = false end Humanoid.HealthChanged:connect(regenHealth)
if any one can fix i would greatly appreciate it
Some nit-picky things here to start: Line 2 of your first script, there is no space between player = game.Players.LocalPlayer
It shouldn't really affect anything, but it is there.
--script 1 player =game.Players.LocalPlayer wait()
The "wait" time is not specified... this could be a potential stopping point for your script.
Line 18:
if regening then return end
Your if statement has an argument, but no condition... Maybe try:
function regenHealth() if regening == true then return -- I typically have it return something to to the output so I can determine if the script is running properly until that point. end
Let me know if this helps at all, I would be glad to look at it more if this does not work for it.