Need help with model tween rotation?

I’m making a crossy road inspired game and I need help rotating the car so it’s correctly orientated and will look more realistic

here is a video of the problem I’m having
robloxapp-20230628-1259083.wmv (1.3 MB)

I’ve tried using car.PrimaryPart.Orientation = vector3.new(0, 180, 0) but that like makes the whole car invisible for some reason…

Heres the script

local tweenService = game:GetService("TweenService")
local spawner = script.Parent
local Cars = game.ServerStorage.Cars:GetChildren()

function SpawnCar()
	local Car = Cars[math.random(1, #Cars)]:Clone()
	local slideAmount = 150
	
	Car.PrimaryPart.CFrame = spawner.CFrame
	Car.Parent = workspace.Cars
	
	local originalCFrame = Car.PrimaryPart.CFrame
	
	local tweenInfo = TweenInfo.new(
		3,
		Enum.EasingStyle.Linear,
		Enum.EasingDirection.In,
		0,
		false,
		0
	)

	local tween = tweenService:Create(Car.PrimaryPart, tweenInfo, {CFrame = originalCFrame + Vector3.new(0, 0, slideAmount)})

	tween:Play()
	tween.Completed:Wait()
	Car:Destroy()
end

while true do
	spawn(function()
		SpawnCar()
	end)
	
	wait(math.random(1, 1.5))
end

I hope this isnt a hard fix just like a line or 2 of code but I appreciate any help.

Brant

1 Like

Instead of only rotating the primarypart, why dont you loop through the rest of the parts as well?
And make sure your car is welded to the primary part if you want the car to rotate along with it

1 Like

I actually did a different approach. I was looking at the CFrame guide and realized you could also assign the orientation as well. So I just added * CFrame.Angles(0, math.rad(180), 0) to Car.PrimaryPart.CFrame = spawner.CFrame * CFrame.Angles(0, math.rad(180), 0)

:man_facepalming:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.