No open Door when player is idle

Hello everyone!, I made a door that can open and close automatically, the problem is when player is idle on the door it opens and closes, and it is kinda annoying, here is a demostration.

I hope you can help me, thank you!.

you can just check the players speed and add a debounce

there’s probably be better solutions though so idk

1 Like

i will try it, thank you for replying!

1 Like

hey, sorry i read through this post again and it seems you already have a delay between opening and closing. so just check the players speed, sorry, if you have any questions ask me

(edit: nevermind)

1 Like

I tried the debounce and it really works, but I’m having problems with find the character, it says Character is not a valid member of Players “Players”, and this is what I wrote

1 Like

oh, nevermind then.

also for character just do

local character = game.Players.LocalPlayer.Character
1 Like

Okay i will try it!, thank you!

1 Like

local character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait() would be an better option in case the player’s character is set to nil (a good example would be when the player dies, their character will be set to nil until they respawn once again, causing the script to break)

I tried the debounce and the walk speed and it works!, thank you so much!

no problem, good luck on your game

1 Like

Can you please provide us the script? We can’t help anything without it.

1 Like

Hi thank so much for reply!, I have been able to solve the problem!

1 Like