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

TweenService Not Working For My Build?

Asked by 3 years ago

So, i'm currently making a theatre in Roblox, with moving sets, and Curtains, but i can't seem to get the script to work? So, i did some research and was told to use TweenService, so i tried a few different scripts to try to get my curtains to work, and it isn't working. Could it possibly be a naming error? Heres the script i used: open = false

door1 = script.Parent.Parent.Parent.Door1

door2 = script.Parent.Parent.Parent.Door2

local TweenService = game:GetService("TweenService")

local part = script.Parent

local tweenInfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)

local Door1Open = {CFrame = door1.CFrame + door1.CFrame.lookVector * 4}

local Door2Open = {CFrame = door2.CFrame + door2.CFrame.lookVector * 4}

local Door1Close = {CFrame = door1.CFrame }

local Door2Close = {CFrame = door2.CFrame }

local Open1 = TweenService:Create(door1,tweenInfo,Door1Open)

local Open2 = TweenService:Create(door2,tweenInfo,Door2Open)

local Close1 = TweenService:Create(door1,tweenInfo,Door1Close)

local Close2 = TweenService:Create(door2,tweenInfo,Door2Close)

script.Parent.MouseClick:connect(function()

if open == false then

    Open1:Play()

    Open2:Play()

    wait(2)

    open = true

else

    Close1:Play()

    Close2:Play()

    wait(2)

    open = false

end

end)

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

You put the tween info table thing as brackets and not curly brackets

local tweenInfo = TweenInfo.new{2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0}
Ad

Answer this question