Hello,
I’m trying to make ticket gates for my game, and for the most part, it works just fine. However on the ones that I have flipped 180 for people passing in the other direction, the right barrier’s tweening takes the “long way” to get to/from the “open” orientation, by spinning round rather then just moving the short way. I’ve probably explained this horribly, so I’ll attach a video:
robloxapp-20210907-1438544.wmv (2.4 MB)
Notice how its only the right side barrier that does this.
The movement of the barriers is done through Tweening:
local function openR()
local TweenService = game:GetService("TweenService")
local part = rclosed
local goal = {}
goal.Position = Vector3.new(ropen.Position.X, ropen.Position.Y, ropen.Position.Z)
goal.Orientation = Vector3.new(ropen.Orientation.X, ropen.Orientation.Y, ropen.Orientation.Z)
local tweenInfo = TweenInfo.new(1)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
wait(0.1)
rclosed.CanCollide = false
wait(2)
--close
lclosed.CanCollide = true
local TweenService = game:GetService("TweenService")
local part = rclosed
local goal = {}
goal.Position = Vector3.new(rorigin.Position.X, rorigin.Position.Y, rorigin.Position.Z)
goal.Orientation = Vector3.new(rorigin.Orientation.X, rorigin.Orientation.Y, rorigin.Orientation.Z)
local tweenInfo = TweenInfo.new(1)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:Play()
end
^ The function for the right side barrier opening/closing. If you need to see the whole script I can provide that too.
I’m not sure how to get around this problem. One thing that I have noticed is that when the whole model is rotated 180 degrees, both barriers work fine, and without issue. I do not see how the model’s orientation itself would affect this though, as I use the invisible “open barriers” and use their positions/orientations to allow the script to always know where the correct open position is.
I know I’ve explained this horribly so I apologise in advance, but I hope you can at least understand what I mean. Any help would be greatly appreciated