Roblox studio bug breaking my game

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)
2 Likes

You already posted this.

local cframe, s = model:GetBoundingBox

Returns an error.

fixed it, read the edited message

instead of using this model:GetPivot() also works

It works! TYSM! I have been trying for ages to do this!