Here is my script:

			elseif string.lower(string.sub(msg, 1, 6)) == "health" then
				
				local strPlayerHealth = string.match(msg, "%d+")
				print(strPlayerHealth) -- output 500
				if strPlayerHealth then
					print("got here")
					local numPlayerHealth = tonumber(strPlayerHealth)
					
					if numPlayerHealth <= 1000 then
					print("Got here")
					humanoid.Health = numPlayerHealth
					print(humanoid.Health) -- output 100

					end
				end
			end

what is going on here? Thanks for any help!

2 comments

0

You need to update the max helth before setting the new hp

0

Thanks guys! Got it to work.