Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Wait script is not working Door stays open for 7-9 sec everytime how can i fix this?

Asked by 3 years ago
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(-100),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

ProximityPrompt.Triggered:Connect(function()
    doorCFrame:Play()
    ProximityPrompt.Enabled = false
    script.Parent.Open:Play()--rbxassetid://192416578
    wait(1)--Door Stays Open this long
    doorCFrameClosed:Play()
    ProximityPrompt.Enabled = true
    wait(1)
    script.Parent.Close:Play()

end)

Answer this question