Im using a simple script I got off a tutorial. I know how the script works like 99% but I don’t want you to hold E then It opens and you then have to hold E again to close it. I want it to just open then waits 3 seconds and then it closes.
Here you go just paste this over what you have already.
local ProximityPrompt = script.Parent
local Door = script.Parent.Parent
local Open = false
ProximityPrompt.Triggered:Connect(function()
if not Open then
Open = true
Door.Transparency = 0.5
Door.CanCollide = false
ProximityPrompt.Enabled = false
wait(3)
Door.Transparency = 0
Door.CanCollide = true
Open = false
ProximityPrompt.Enabled = true
end
end)
Do not use that code. That can lead to multiple people activating it again even when it is open.
Create a bool value inside the script and use that bool value to make sure it doesn’t activate after it is activated.
I don’t know if this is working or not however a check that it is enabled or not must be there.
local ProximityPrompt = script.Parent
local Door = script.Parent.Parent
local Bool = script.Enabled
ProximityPrompt.Triggered:Connect(function()
if Bool.Value == false then
Bool.Value = true
Door.Transparency = 0.5
Door.CanCollide = false
wait(3)
Door.Transparency = 0
Door.CanCollide = true
Bool.Value = false
end
end)
Also the last line of code that changes the actionname to close makes it one time use only! so i had to remove that if it was going to be reused