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

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

Asked by 8 years ago

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

Log in to vote
0
Answered by
yoshi8080 445 Moderation Voter
8 years ago

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.

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... MBacon15 97 — 8y
0
your welcome yoshi8080 445 — 8y
Ad

Answer this question