Hola amigos! Does anyone happen to know how I can detect if someone is touching / wen’t throught the non-collideable door? :
This would be super usefull! Thank you for every comment! :>
Hola amigos! Does anyone happen to know how I can detect if someone is touching / wen’t throught the non-collideable door? :
This would be super usefull! Thank you for every comment! :>
Detecting a player touching a wall is very simple, I’ll show you how:
local Players = game:GetService("Players")
local Debounce = false
script.Parent.Touched:Connect(function(Hit)
local Player = Players:GetPlayerFromCharacter(Hit.Parent)
if Player and Debounce == false then
Debounce = true
print(Player.Name.." walked through the door!")
task.wait(1)
Debounce = false
end
end)
This code works when it is inside of a part. The Debounce
variable says if they can touch the part and it will detect it or not. The task.wait(1)
waits for a specified amount of time, so you can change the number inside of the parentheses to wait for a different amount of time.
Here’s what will happen with the current code:
In the output it prints, “[username] walked through the door!”
I hope this helps!
AHH OMG. I dind’t knew the Touched Event can be used also for non-collideable things! Thank you for telling me! <3