Roblox is gaslighting me

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i’m trying to have my function actually stop when it’s supposed to
  2. What is the issue? Include screenshots / videos if possible!

    i’m exiting out of the function with return and gatekeeping the task.delay with an if statement, but the functions till proceeds to run infinitely without returning errors
  3. What solutions have you tried so far? Did you look for solutions on the Creator Hub?
    no i doubt there’s a solution that isn’t what should work but doesn’t
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

this is the function i have that doesn’t stop

function Shifter:SteamHeal()
	local Humanoid = self.Character.Humanoid

	print('WHYJUSTWHY')
	
	if not self.SteamHealingActive then
		self.SteamHealingActive = true
		Remote:FireAllClients('AddVFX', ReplicatedStorage.Assets.VFX.Shifters.SteamHeal, self.Character)
	end
	
	self.Energy -= 0.2
	Humanoid.Health += 10
	
	if Humanoid.Health == Humanoid.MaxHealth or not self.SteamHealing then
		if not self.Shifted then
			Remote:FireAllClients('ClearVFX', 'SteamHeal', self.Character)
		end

		print('Cleared ?-')
		self.SteamHealingActive = false
		task.spawn(self.RegenerateEnergy, self)
		return
	end
	
	if self.SteamHealingActive then
		task.delay(1, self.SteamHeal, self)
	end
end

these are the two functions i have that enable/start the loop

Humanoid.HealthChanged:Connect(function(health)
	if health < Humanoid.MaxHealth and not self.SteamHealingActive and not self.Shifted and self.SteamHealing then
		print(self.SteamHealing)
		task.spawn(self.SteamHeal, self)
	end
end)

function Shifter:ToggleSteamHeal()
	self.SteamHealing = not self.SteamHealing
	Notify(self.player, 'Steamheal set to '..tostring(self.SteamHealing), self.SteamHealing)
	if not self.SteamHealing or self.SteamHealingActive or self.Character.Humanoid.Health == self.Character.Humanoid.MaxHealth then return end
	self:SteamHeal()
end

why does roblox have something against me / what am i doing wrong???

1 Like

Try changing

	if Humanoid.Health == Humanoid.MaxHealth or not self.SteamHealing then

to this

if Humanoid.Health >= Humanoid.MaxHealth or not self.SteamHealing then

It’s possible that you’re adding more health than max which then doesn’t make it equal to

1 Like

maybe try continue instead of return, also change == to >=

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.