I am making an SCP game and I am scripting for SCP 173. Here's the script:

local part = script.Parent

part.Touched:Connect(function(hit)
	local hum = hit.Parent:FindFirstChild("Union")
	if hum then
		repeat
		script.Parent.Anchored = true
			print("Player see")
			wait(1)
		until hum == nil
	elseif hum == nil then
		repeat
		script.Parent.Anchored = false
			print("player ignore")
			wait(1)
	    until hum
		end
			
		
	end)



i am trying to do a repeat but it just doesn't stop. Help appreciated!

4 comments

0

it doesn't stop because the humanoid is never nil. You need to find an alternative to this or set the hum to nil. Instead, check if the humanoid's health is < 0.

0

hum is just the random name i put for a union variables its not humanoid actually

0

Hum has no value try putting like a value into your Union and make it nothing