How do I fix this?

I’m trying to move a part, but got this error.

 21:49:51.303  Position cannot be assigned to  -  Server - ModuleScript:5
  21:49:51.304  Stack Begin  -  Studio
  21:49:51.304  Script 'ServerScriptService.Modules.ModuleScript', Line 5 - function Move  -  Studio - ModuleScript:5
  21:49:51.304  Script 'Workspace.oxygenAtom.Move', Line 6  -  Studio - Move:6
  21:49:51.305  Stack End  -  Studio

How do I fix this?

local module = {}

function module:Move(object, SOM) -- SOM = State of Matter
	for i = 1,75 do task.wait(.4)
		object.CFrame.Position += Vector3.new(math.random(-1, 1), 0, math.random(-1, 1))
	end
end

return module

Need an example of how you are calling module:Move

CFrames aren’t mutable so you either need to change the part’s position property or apply an offset (eg. object.CFrame *= CFrame.new(math.random(-1, 1), 0, math.random(-1, 1))).

Is it because you setting both Position and CFrame? Use one, in your case, position.

just realized i replied to you :sweat_smile: meant to reply to OP

the part position property doesn’t exist anymore

It does still exist. It just appears under CFrame in the properties panel which may be a bit misleading as it can’t be written to through the CFrame property.

2 Likes

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