I'm creating an animated sliding gate. But whenever I open the gate, the gate tweens to its position, but the orientation gets affected as well (i.e rotates 90° during the animation)
Is there a method to only tween the position, completely ignoring orientation?
Here is my code I am working with:
local TweenService = game:GetService("TweenService")
local gatemain = script.Parent:WaitForChild("GateMain")
local info = TweenInfo.new(3.4,Enum.EasingStyle.Quint,Enum.EasingDirection.In,0,false,0)
local gatemainopen = {CFrame = CFrame.new(-499.15, 30.5, -63.35)}
local gatemainclose = {CFrame = CFrame.new(-517.15, 30.5, -63.35)}
local tweengatemainopen = TweenService:Create(gatemain,info,gatemainopen)
local tweengatemainclose = TweenService:Create(gatemain,info,gatemainclose)
local dooropen = false
function onTouch(hit)
local Gatekey = hit:FindFirstChild("GateKey")
if Gatekey then
if dooropen == false then
tweengatemainopen:Play()
dooropen = true
else
tweengatemainclose:Play()
dooropen = false
end
end
end
script.Parent.GateMain.Touched:Connect(onTouch)

4 comments
Change the CFrame = ... to Position = ... this should work
An error popped up showing: 'Position' cannot be tweened due to type mismatch.
Ah, I solved it. I changed CFrame = CFrame.new(... to Position = Vector3.new(... and it got things working. Thank you for your comment, I was able to expand on it.
You're welcome.