script.Parent.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil then hit.Position = Vector3.new(-18, 0.5, -9) end end )
I want to make sure that when the player touches this object (Door) on accident they don't get teleported out.
I'm probably going to end up utilizing a while loop but I don't know what my condition would be exactly to check time.
local touched = 5 -- Number of times before it works. local debounce = false local debouncetime = 0.5 -- .Touched will fire repeatedly, this will cool it down for a second. script.Parent.Touched:Connect(function(hit) if debounce == false then local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil then hit.Position = Vector3.new(-18, 0.5, -9) end debounce = true coroutine.wrap(function() wait(debouncetime) debounce = false end)() end end)
Hope this helps!