I'm trying to make it so when a person sits on a seat and a button is pressed, a part comes from the ceiling (invisible) and removes limbs, it works a few times but then it just stops working.
local debounce = false function onTouched(hit) if debounce == false then debounce = true local human = hit.Parent:FindFirstChild("Humanoid") local arm1 = hit.Parent:FindFirstChild("RightHand") local arm2 = hit.Parent:FindFirstChild("RightLowerArm") local head = hit.Parent:FindFirstChild("Head") local scream = Instance.new("Sound") scream.SoundId = "rbxassetid://147758618" scream.Volume = 2 scream.MaxDistance = 250 scream.EmitterSize = 10 scream.PlayOnRemove = false if (human ~= nil) then scream.Parent = head scream:Play() human.Health = 80 arm2:Destroy() arm1:Destroy() wait(15) debounce = false end end end if (script.Parent ~= nil) and (script.Parent.className == "Part") then connection = script.Parent.Touched:connect(onTouched) end
Also, if there's a way to execute the script on the player whos sitting, then that would be easier. I don't understand how to find the player who is in the seat, and I know it's a better way to do it. So if you could help me either way then thanks.