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

2 comments
Is this a local Script?
this first script is but the second 1 is a normal script the second 1 goes into the player char so i don't think it need to be local ill try it as a localscript