Hi, at the moment this script will work but when my character touches the brick it sometimes loses health or gains health. I have tried making the numbers both negative but that just errors. So, I would appreciate it if anyone could help me with this?
script.Parent.Touched: connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil and humanoid.Health > 0 then local f = Instance.new("Fire", hit.Parent) f.Color = Color3.new(0, 85, 255) humanoid.Health = math.random(35, 100) end end)
You would have to subtract their health:
humanoid.Health = humanoid.Health - math.random(1, humanoid.Health)
Subtracting their health guarantees that they take damage.
Make the humanoid take damage
humanoid:TakeDamage(math.random(35,100))