Weird cframe problem

Hello, my spaceship model movement script has
Screenshot_18
a weird error

Model trying move but stuck in the same frame I try to delete baseplate

local vehicle = script.Parent
local speed = 30 -- studs per second
game:GetService("RunService").Heartbeat:Connect(function(dt) -- 'dt' is the time in seconds since the last physics frame, we can use it to more accurately calculate the vehicle's position WRT time.
	vehicle:SetPrimaryPartCFrame(vehicle.PrimaryPart.CFrame * CFrame.new(0, 0, -1 * speed * dt))
end)

1st script

local XV = script.Parent.X
local YV = script.Parent.Y
local ZV = script.Parent.Z

while wait() do
	script.Parent:SetPrimaryPartCFrame(CFrame.Angles(XV.Value, YV.Value, ZV.Value))
end

2nd script

Thanks for help :smiley:

It seems you are just overwriting the CFrame every loop in the 2nd script because when you called CFrame.Angles, it has a position of 0,0,0 (so you teleport the model to 0,0,0). Is that consistent with what the issue is?

İt’s right also I think this is only cframe rotation, I don’t know how to set cframe to any rotation
this flipping in the loop, sorry I learned now cframe orientation(I knew already cframe but only change the position)

local XV = script.Parent.X
local YV = script.Parent.Y
local ZV = script.Parent.Z

while wait() do
	script.Parent:SetPrimaryPartCFrame(script.Parent.PrimaryPart.CFrame * CFrame.fromEulerAnglesXYZ(XV.Value, YV.Value, ZV.Value))
end

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