I have a GUI that teleports you to an obby. When you finish the obby, you can choose to add 5 to your health, but when you go back to the main game, you lose all that health! Why?
function onTouched(part)
if script.Parent.Available.Value == 0 then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
--my part
h.MaxHealth = h.MaxHealth + 5
h.Health = h.Health + 5
wait(0.001)
script.Parent.Available.Value = 1
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
part.Parent.Torso.CFrame = CFrame.new(Vector3.new(-0.6, 27.5, -3))
end
wait(1)
script.Parent.Available.Value = 0
--end of my part
end
end
end
script.Parent.Touched:connect(onTouched)
~this is not my entire script, i just did the middle part Please help! Thank you!

2 comments
Not what I was asking, the script works fine, but the health doesn't transfer when teleporting through games
Well, that's totally to be expected. If you want the health to transfer over, you'd probably be best-off using DataStores to transfer that data.