Invalid argument #1 (CFrame expected, got nil)

Hello! I’m not sure why it gave this error. I’ve seen a post similar to this but it was on a model. These parts are all mesh parts. I also would like to know why all the parts won’t move but one, thanks!

-- SETTINGS --
local Tag = "starRotate"

local Stars = workspace:WaitForChild("Stars")


local CS = game:GetService("CollectionService")

for _,v in ipairs(CS:GetTagged(Tag)) do
	
	local TweenService = game:GetService("TweenService")
	--	local TweenSettings = TweenInfo.new(math.random(1,2), Enum.EasingStyle.Linear, Enum.EasingDirection.In)
	local TweenSettingsFloat = TweenInfo.new(
		3,
		Enum.EasingStyle.Quad,
		Enum.EasingDirection.InOut, 
		-1, 
		true,
		0
	)


	print(v)



	--	local TweenFloat = TweenService:Create(v, TweenSettingsFloat, {	CFrame = v.CFrame * CFrame.fromEulerAnglesXYZ(0, 1, 0)})

	--TweenFloat:Play()
	
	local cf = CFrame.Angles(0, math.rad(math.random(4)),0)

	while true do
		wait()
		v.CFrame = v.CFrame * cf
	end	
end

What is the line that the error is on? This will help narrow down what the problem is.

This is the line, I’m not very experienced with Cframe and etc so

It looks like it would work fine… But I’m not the best with CFrames either. Usually that error comes if it’s not the right Vector3 (I think) but they’re all using CFrame.

absolutely wrong. the error is because they called a function with empty arguments. it should be fn(cframe_thing) but they used fn(nil) (the fn expects the first argument to be a cframe class)

1 Like

What are fn if you don’t mind me asking?

fn is a short for function


1 Like