Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[Help] Moving a tool to a part in the workspace??

while true do
	local lighting = game:GetService("Lighting")
		wait(10) -- just the testing num
local part = lighting.DFStuff.MaguMagu:Clone()-- soon to be random.
part.Parent = game.Workspace.Spawner
part.CFrame.new = -1402.449, -6.135, 964.843 -- parts dont got a position so I tried cframe
	
end

For some odd reason, this isn't working. Yes, i've tried position.

1 answer


Setting A Part's CFrame


Frankly, this isn't actually odd at all, the way you construct a cframe is with the CFrame.new() function, not to be confused with the CFrame property of a part.

The proper formatting should be along the lines of:

Part.CFrame = CFrame.new(...)

So a fixed version of that line would be:

part.CFrame = CFrame.new(-1402.449, -6.135, 964.843) 

A couple other things to taking into account:

  • don't use lighting to store objects, ServerStorage and ReplicatedStorage exist for a reason.

  • Don't use infinite loops when they aren't needed

  • Parts do have a position property, it really shouldn't be used unless you want movements to take into account collisions

Hopefully this helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.