The script is adding 50 health to my character but when i press the button it adds 150 Health and Max Health. I did have it like this before, but I have since changed it just to add 50 health. 2. This is not on team create
local db = false
script.Parent.Touched:Connect(function(part)
local humanoid
if part.Parent.Humanoid then
humanoid = part.Parent.Humanoid
elseif part.Parent.Parent.Humanoid then
humanoid = part.Parent.Parent.Humanoid
end
if humanoid ~= nil and db == false then
db = true
if humanoid.Health >= 99 then
humanoid.Health = humanoid.Health + 50
script.Parent.Parent:Destroy()
else if humanoid.Health == 100 then return end
end
wait(1)
db = false
end
end)
This worked but I don’t know why it’s still adding onto my max health. I mean I do, but like why is it still adding max health. I thought if you keep the max health at 100 the health can’t go over 100 hp?
If it’s written on a server-sided script [a normal script] then the problem is that you are editing the
value locally.
Because when you change a value locally, the value doesn’t replicate over to server so the server will still see the value to be 100 [which I presume is full health.]
The next time you test your script out, try changing the value after you click “Current: Client” on the Top -middle section of your screen and check if it works.
Shown here in a gif: https://gyazo.com/138ace88e983cdf504d371163710f417
When i touch the part, The health goes up by 50 of course. Then I go to touch another (by now the health has regenerated enough so it’s going to be over 100 when i touch this)
The Health goes to whatever it is, and the MaxHealth goes to 150.