Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago
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

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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!

Ad

Answer this question