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

I'm making a sliding door that slides when I click it, but it isn't working. How do i fix it?

Asked by 4 years ago
local clickdetector = script.Parent:WaitForChild("ClickDetector")
local TweenService = game:GetService("TweenService")
local door1 = script.Parent:WaitForChild("Door1")
local door2 = script.Parent:WaitForChild("Door2")
local tweeningInformation = TweenInfo.new(
    .5, 
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.In,
    0,
    false,
    0
)
local door1open = {CFrame = CFrame(-113.812, 6.594, -2.288)}
local door2open = {CFrame = CFrame(-113.812, 7.373, -2.289)}
local door1close = {CFrame = CFrame(-113.812, 6.594, 4.212)}
local door2close = {CFrame = CFrame(-113.812, 7.373, 4.211)}
local tween1open = TweenService:Create(door1,tweeningInformation,door1open)
local tween1close = TweenService:Create(door1,tweeningInformation,door1close)
local tween2open = TweenService:Create(door1,tweeningInformation,door2open)
local tween2close = TweenService:Create(door2,tweeningInformation,door2close)

clickdetector.MouseClick:Connect(function(Player)
    tween1open:Play()
    tween2open:Play()
    wait(5)
    tween1close:Play()
    tween2close:Play()
end)
0
instead of using variables for your door1opens, use functions. might not do much but itll be easier s_iara 94 — 4y

Answer this question