Admittedly this is my friend’s script for the game we are putting together, so I’m not entirely sure on all the details.
We are attempting to make a Tween which rotates the crane and all the related parts, completed by welding them together.
The Tween is successful but doesn’t move the ball socket for a solid 2 minutes or so, as it suddenly flings over to the position it’s supposed to be at, which isn’t ideal for what we’re trying to make
local TweenService = game:GetService("TweenService")
local TweenedPart = script.Parent
-- Tween variables
local TweenInfo1 = TweenInfo.new(
30, -- Time
Enum.EasingStyle.Linear,
Enum.EasingDirection.InOut,
0,
true,
0
)
local function TheTweening()
-- Calculate new CFrame for object position and rotation
local offsetCFrame = CFrame.new(0, 0, 0)
local rotatedCFrame = CFrame.Angles(math.rad(0),math.pi/2, 0)
offsetCFrame = offsetCFrame:ToWorldSpace(rotatedCFrame)
local newCFrame = TweenedPart.CFrame:ToWorldSpace(offsetCFrame)
-- Create a tween and play it
local TheTweening = TweenService:Create(TweenedPart, TweenInfo1, {CFrame = newCFrame})
TheTweening:Play()
--wait for time of previous tween before playing the next tween
end
task.wait(5)
while true do
TheTweening()
task.wait(60)
end
I’ve included the Tween script anyway, although we’re 99% sure that isn’t the cause of it, we’re considering trying to create the BallSocketConstraint inside the script instead but we are unsure.
Any help would be appreciated, thank you!