debounce=true local g=script.Parent.Parent function onTouched(R)local Z=R.Parent:findFirstChild("\072\117\109\097\110\111\105\100")if Z~=nil and debounce==true then if script.Parent.Captured.Value==false then debounce=false Z.Health=Z.Health-Z.Health/100 R.Parent["\082\105\103\104\116 \076\101\103"].Anchored=true R.Parent["\076\101\102\116 \076\101\103"].Anchored=true g.Open.Transparency=1 g.Close.Transparency=0 script.Parent.Bang:Play()script.Parent.Ow:Play()wait(.5)R.Parent.Torso.Anchored=true script.Parent.Captured.Value=true wait(3)script.Parent.ClickDetector.MaxActivationDistance=16 R.Parent["\082\105\103\104\116 \076\101\103"].Anchored=false R.Parent["\076\101\102\116 \076\101\103"].Anchored=false Z.Jump=true R.Parent.Torso.Anchored=false debounce=true end end end script.Parent.Touched:connect(onTouched)
--[[
	I should note that this works
	amazingly in third person, but
	not so much in first person.
--]]

debounce = true
local trap = script.Parent.Parent

function onTouched(i)
	local h = i.Parent:findFirstChild("Humanoid")
	if h ~= nil and debounce == true then --If the part is a player then
		if script.Parent.Captured.Value == false then
			debounce = false
			h.Health = h.Health - h.Health / 100 --Take all of the player's health away
			i.Parent["Right Leg"].Anchored = true --Anchor their legs
			i.Parent["Left Leg"].Anchored = true
			trap.Open.Transparency = 1 --Close the trap
			trap.Close.Transparency = 0
			script.Parent.Bang:Play() --Play audios
			script.Parent.Ow:Play()
			wait(0.5)
			i.Parent.Torso.Anchored = true --Anchor their torso so they don't flail around
			script.Parent.Captured.Value = true
			wait(3) --Wait 3 seconds
			script.Parent.ClickDetector.MaxActivationDistance = 16 --Make it so that you can set up the trap again
			i.Parent["Right Leg"].Anchored = false --Free the player
			i.Parent["Left Leg"].Anchored = false
			h.Jump = true --Make sure the player isn't glitched
			i.Parent.Torso.Anchored = false
			debounce = true
		end
	end
end

script.Parent.Touched:connect(onTouched)
