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

Doors Not Tweening Orientation Correctly?

Asked by
Donut792 216 Moderation Voter
5 years ago

Alright so at first this tween worked perfectly just as intended but after hitting play a second time the tween is all wonky it for some reason makes the doors spin to their position and with some doors its the same with the wrong rotation but with the same script in another door it works fine as if its an error with Union (the doors are Unions) so im slightly confused on this and im not sure if its the script that is the error or studio being studio Script:

local TweenService = game:GetService("TweenService")

local IsOpen = false

local FirstPos = script.Parent.FirstPos

local SecondPos = script.Parent.SecondPos

local Door = script.Parent.Door

local Event = script.Parent.InteractWithDoor



Event.OnServerEvent:Connect(function()

if IsOpen == false then

local goal = {}

goal.Position = SecondPos.Position

goal.Orientation = SecondPos.Orientation

--goal.Color = Color3.new(0, 1, 0)

local tweenInfo = TweenInfo.new(1.5)

local tween = TweenService:Create(Door, tweenInfo, goal)

tween:Play()

IsOpen = true

elseif IsOpen == true then

local tweeninfo = TweenInfo.new(1.5)

local goal = {}

goal.Position = FirstPos.Position

goal.Orientation = FirstPos.Orientation

local tween = TweenService:Create(Door, tweeninfo, goal)

tween:Play()

IsOpen = false

end

end)

Answer this question