How would i break this script

Title says it all, how would i break this script

monster.Humanoid.HealthChanged:Connect(function(Health)
	if Health <= 200000 then
		local forcefield = Instance.new("ForceField")
		forcefield.Parent = monster
		forcefield.Visible = true
		wait(6)
		forcefield:Destroy()
	end
end)

What do you mean by β€œbreak” specifically?

stop the script from looping again

Do you mean to stop the event from firing again? There are no loops here.

Just disconnect the connection after the condition is fufilled.

local HealthChangedConnection = nil :: RBXScriptConnection?
HealthChangedConnection = monster.Humanoid.HealthChanged:Connect(function(Health)
	if Health <= 200000 then
		local forcefield = Instance.new("ForceField")
		forcefield.Parent = monster
		forcefield.Visible = true
		wait(6)
		forcefield:Destroy()
		HealthChangedConnection:Disconnect()
	end
end)
1 Like

just turn off the script β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž β€Ž

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