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

Door won't play it's animation when activated?

Asked by 3 years ago

I am working on a door that plays an opening animation when you scan your finger print with a proximity prompt. The door animation won't play but there is nothing in the output. This is a normal script inside the door model. Please help, thanks!

local DoorModel = script.Parent.Door
local FingerScan = script.Parent.FingerScanner.Scan.ProximityPrompt
local activated = false
local TweenService = game:GetService("TweenService")

local tweeninfo = TweenInfo.new(    
    DoorModel.Speed.Value,
    Enum.EasingStyle.Quart,
    Enum.EasingDirection.Out,
    0,
    true,
    0   
)

local function open(OtherPart)
    local Player = game.Players:FindFirstChild(OtherPart.Parent.Name)
    if Player and not activated then

        activated = true

        local TweenDoor = TweenService:Create(DoorModel.Main, tweeninfo, {Position = DoorModel.Target3.Position})
        local TweenDoor1 = TweenService:Create(DoorModel.Main, tweeninfo, {Position = DoorModel.Target1.Position})
        local TweenDoor2 = TweenService:Create(DoorModel.Main, tweeninfo, {Position = DoorModel.Target2.Position})

        TweenDoor1:Play()
        wait(0.5)
        TweenDoor2:Play()
        TweenDoor.Completed:Wait()
        wait(2)

        TweenDoor1:Play()
        wait(0.5)
        TweenDoor:Play()
        TweenDoor.Completed:Wait()
        wait(2)

        activated = false
    end
end

FingerScan.Triggered:Connect(open)

Answer this question