Why does the posirion of the Tram model change? I only want the orientation to change. The position changes to 0,0,0.
local newCF = CFrame.Angles(0, 0, 0) -- Rotate by 180 deg around the Y axis
function Click(Player)
workspace:FindFirstChild("Tram"..Player.Name):PivotTo(newCF)
if Player.Character then
wait(1)
Player.Character:MoveTo(workspace:FindFirstChild("Tram"..Player.Name).One.VehicleSeat.Position)
end
end
script.Parent.ClickDetector.MouseClick:Connect(Click)
its thinking the position of that cframe is 0, 0, 0 because you never added anythinng
change it to this
local model = workspace:FindFirstChild("Tram"..Player.Name)
local cframe, s = model:GetBoundingBox()
local newCF = cframe * CFrame.Angles(0, math.rad(180), 0)
model:PivotTo(newCF)