Hi, so i am currently working on a reclining chair system for my movie theater game, and i have been trying to make the tweens use math so i dont need to change the script every time i duplicate the chair and move it.
Here is the behavior that i get without math.
This is the behavior i get when i am trying to use math with the tween.
i actually calculated the right vector3 for everything.
and here is the important stuff. the code:
local det = script.Parent.ClickDetector
local reclined = false
local tweenservice = game:GetService("TweenService")
local legs = script.Parent.Parent.footrest
local back = script.Parent.Parent.backrest
local tinfo = TweenInfo.new(1.5,Enum.EasingStyle.Linear)
local reclineleg = tweenservice:Create(legs,tinfo,{Position = Vector3.new(legs.Position.X, legs.Position.Y - 0.69,legs.Position.Z - 0.84), Orientation = Vector3.new(legs.Orientation.X + 85, legs.Orientation.Y,legs.Orientation.Z)})
local reclineback = tweenservice:Create(back,tinfo,{Position = Vector3.new(back.Position.X,back.Position.Y,back.Position.Z - 0.62), Orientation = Vector3.new(back.Orientation.X + 20,back.Orientation.Y,back.Orientation.Z)})
local reclineleg2 = tweenservice:Create(legs,tinfo,{Position = Vector3.new(legs.Position.X, legs.Position.Y + 0.69,legs.Position.Z + 0.84), Orientation = Vector3.new(legs.Orientation.X - 85, legs.Orientation.Y,legs.Orientation.Z)})
local reclineback2 = tweenservice:Create(back,tinfo,{Position = Vector3.new(back.Position.X,back.Position.Y,back.Position.Z - 0.62), Orientation = Vector3.new(back.Orientation.X - 20,back.Orientation.Y,back.Orientation.Z)})
I also forgot to include, the code for the chair that does not use math for the tweens are the exact same, but instead of back.Position.X in the Vector3 spaces, it is an actual coordinate.