Hi, I am using a spring to “tween” this model and when moving the slide (:: Part
) if the entire model is rotated 90deg the movement will go in the wrong direction. I understand this is to do with using the Vector3, however is there anyway this script can automatically work with different rotations whilst keeping the same basis? Thanks.
self.Door1 = door:FindFirstChild("Door")
self.Door2 = door:FindFirstChild("Door2")
self.Door1Resting = self.Door1.Slide.Position.Z
self.Door2Resting = self.Door2.Slide.Position.Z
self.Door1Opened = self.Door1.Slide.Position.Z + 2
self.Door2Opened = self.Door2.Slide.Position.Z - 2
self.MovementSpring.Target = self.Door1.Slide.Position.Z
self.MovementSpring.Position = self.Door1.Slide.Position.Z
self.MovementSpring2.Target = self.Door2.Slide.Position.Z
self.MovementSpring2.Position = self.Door2.Slide.Position.Z
task.spawn(function()
self.Maid= self.Maid:GiveTask(RunService.Heartbeat:Connect(function(dt)
self.MovementSpring:Update(dt)
self.MovementSpring2:Update(dt)
self.Door1.Slide.Position = Vector3.new(self.Door1.Slide.Position.X, self.Door1.Slide.Position.Y, self.MovementSpring.Position)
self.Door2.Slide.Position = Vector3.new(self.Door2.Slide.Position.X, self.Door2.Slide.Position.Y, self.MovementSpring2.Position)
end))
end)