Every time I think I understand where to put a debounce I do it wrong. Can someone show me where to put this debounce and explain why it goes in the spot you put it? I would greatly appreciate it.
Thanks
local TweenService = game:GetService("TweenService")
local door = script.Parent
local doorHinge = door.PrimaryPart
local doorOpen = TweenInfo.new()
local doorCFrame = TweenService:Create(doorHinge, doorOpen, {
CFrame = doorHinge.CFrame * CFrame.Angles(0, math.rad(-90),0)--Change 100 to whatever value. Range of swing.
})
local doorCFrameClosed = TweenService:Create(doorHinge, doorOpen, {
CFrame = doorHinge.CFrame * CFrame.Angles(0, math.rad(0),0)--Change 100 to whatever value. Range of swing.
})
local ProximityPrompt = script.Parent.ProximityPrompt
local PromptVanish = ProximityPrompt.Enabled == false
local PromptAppear = ProximityPrompt.Enabled == true
local debounce = false
ProximityPrompt.Triggered:Connect(function()
debounce = true
doorCFrame:Play()
ProximityPrompt.Enabled = false
script.Parent.Open:Play()--rbxassetid://192416578
wait(3)--Door Stays Open this long
doorCFrameClosed:Play()
ProximityPrompt.Enabled = true
script.Parent.Close:Play()
debounce = false
end)