How would i do 360+ rotation with cframe

im currently using a script to rotate an object


and it only does the closest rotation, how would i do it so it rotates the full extent of the way?

1 Like

by doing linear interpolation rather than tweens

-- LocalScript in StarterPlayerScripts
task.wait(3) --so I can check it from the start
--
local rs = game:GetService("RunService")

local part = Instance.new("Part", workspace)
part.Anchored = true
part.Size = Vector3.new(4,4,4)
part.CFrame = CFrame.new(0,5,0)

local model = Instance.new("Model", workspace)
part.Parent = model
model.PrimaryPart = part

local function rotateModel(model, duration)
	local start = tick()
	while tick() - start < duration do
		local a = ((tick() - start) / duration) * math.rad(360)
		model:SetPrimaryPartCFrame(CFrame.new(0,5,0) * CFrame.Angles(0, a, 0))
		rs.Stepped:Wait() --or task.wait()
	end
	model:SetPrimaryPartCFrame(CFrame.new(0,5,0))
end

rotateModel(model, 3) --,speed

Please use the </> option when posting scripts. Yes, I’m lazy.

1 Like

needs to keep the position of said model not set it to 0,5,0 (and sorry for not using </> mb…)

you can make it 180 degree and add a 1 after the easing direction in the info of the tween so it will repeat 180 degree 2 times and be 360 degree
now since you wanna make it more than 360 degree then you can just make the rotation half of how many degree you want it to rotate

this just repeats the same motion
(using local CF = (model thing).cframe * CFrame.Angles(math.rad(180),math.rad(0),math.rad(0))