So I’ve made some simple open-close doors with proximity prompt. It works that way that:
- You trigger prompt
- Door opens (prompt gets disabled)
- After 5 seconds the door closes and it re-enables the prompt
Well my script for some reason does that when I open the door the prompt gets disabled but only for like a second and then it instantly re-enables the prompt without waiting for doors to fully close (I have 2 seperate prompts on each side of door )
local l = script.Parent.FreezerDoorL.Door
local r = script.Parent.FreezerDoorR.Door
local prompt = script.Parent.Prompt.ProximityPrompt
local prompt2 = script.Parent.Prompt2.ProximityPrompt
local ts = game:GetService("TweenService")
local ti = TweenInfo.new(1, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out)
local ti2 = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.In)
local function openDoors()
-- OPEN DOORS
prompt.Enabled = false
prompt2.Enabled = false
prompt2.Parent.ParticleEmitter:Emit(70)
prompt.Parent.SFX:Play()
ts:Create(l, ti, {CFrame = CFrame.new(-3.35, 11.35, 13.2) * CFrame.Angles(0, math.rad(90), 0)}):Play()
ts:Create(r, ti, {CFrame = CFrame.new(-15.65, 11.35, 13.2) * CFrame.Angles(0, math.rad(-90), 0)}):Play()
-- CLOSE DOORS
task.wait(5)
prompt.Parent.SFX:Play()
ts:Create(l, ti2, {CFrame = CFrame.new(-7.3, 11.35, 13.2) * CFrame.Angles(0, math.rad(90), 0)}):Play()
ts:Create(r, ti2, {CFrame = CFrame.new(-11.7, 11.35, 13.2) * CFrame.Angles(0, math.rad(-90), 0)}):Play()
prompt.Enabled = true
prompt2.Enabled = true
end
prompt.Triggered:Connect(openDoors)
prompt2.Triggered:Connect(openDoors)