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

Able to :Clone() an item in ServerStorage over to a part of a model in Workspace?

I'm trying to make a cannon that will fire projectiles stored in ServerStorage

Whenever I try to call out the item, instead of cloning a freestanding object where the barrel of the Cannon is it just spawns in a freestanding object at the place in the Workspace it was before I moved it to Server Storage.

I need it to be able to be spawned at the "Barrel" point of Model named Cannon to the point where I can apply a vector force and the likes.

local storage = game.ServerStorage
local cBall = storage.cannonBall:Clone()
cBall.Parent = game.Workspace

Using this script below returns an error stating that** MoveTo is not a valid member of Part** on Line 4

local storage = game.ServerStorage
local cBall = storage.cannonBall:Clone()
cBall.Parent = game.Workspace
cBall:MoveTo(game.Workspace.Cannon.Barrel.Position)

Is there a way to get past all of this, a correct way of doing it, or should I try the method along the lines of

cBall = Instance.new("Part")
cBall.name = cannonBall

and so on that will spawn a new freestanding part at the barrel fresh?

Thanks for any help in advance!

~MBacon15

1 answer

✓ Accepted answer

Well I don't think you use MoveTo for parts. I would recommend CFrame or Position to move the part.

Use this to replace the cBall:MoveTo

cBall.CFrame = CFrame.new(game.Workspace.Cannon.Barrel.Position)  --Moves the cannonball to where the barrel is.

Not sure if this works, since I'm not using studio .3.

2 comments

0

Thank you sooooo much! Not only did it work, but now I know about this for future reference. I had always assumed that CFraming was more complicated than that...

0

your welcome

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