Tweening a model directly can be tricky because models don’t have a direct CFrame property. Instead, you need to tween the CFrame of the model’s primary part and then update the positions of all other parts relative to the primary part.
Try this script
local BezierTween = require(game.ServerScriptService.BezierTweens)
local Waypoints = BezierTween.Waypoints
-- Define your points for the Bezier curve
local P0, P1, P2 = workspace.Points.PointA, workspace.Points.PointC, workspace.Points.PointB
local waypoints = Waypoints.new(P0, P1, P2)
-- Reference to your model and its PrimaryPart
local model = workspace.YourModelName -- Replace with your model's name
local primaryPart = model.PrimaryPart
-- Tween the PrimaryPart along the Bezier curve
local tween = BezierTween.Create(primaryPart, {
Waypoints = waypoints,
EasingStyle = Enum.EasingStyle.Sine,
EasingDirection = Enum.EasingDirection.In,
Time = 5,
})
-- Function to update the whole model based on the PrimaryPart
local function updateModelPosition()
local cframe = primaryPart.CFrame
for _, part in ipairs(model:GetChildren()) do
if part:IsA("BasePart") and part ~= primaryPart then
-- Update each part's position relative to the PrimaryPart
part.CFrame = cframe * primaryPart.CFrame:ToObjectSpace(part.CFrame)
end
end
end
-- Connect the update function to the tween
tween.Changed:Connect(updateModelPosition)
-- Start the tween
tween:Play()
tween.Completed:Wait()