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

how i spawn parts from replicated storage?

i want to take spawn a part from replicated storage in the workspace,but i dont know how. i tried:

script.Parent.MouseButton1Click:connect(function()
c = game.ReplicatedStorage.Purchasables.Other.B1.["Model"]:Clone()
c:MoveTo(character.torso)
end)

but dont worked,i tried the same code spawning a part from lightning and worked,but how i do with replicated storage?other thing is that i dont know how to spawn the part near of the local player,always spawn at 0,0,can someone help me?

1 answer

The problem is that you are not setting the parent of the object you are cloning.

##Here is an example on how you would take an item in replicated storage and parent it workspace:

local ItemInStorage = game.ReplicatedStorage.SomePart;
local P = ItemInStorage:Clone();
P.Parent = workspace;

Now here is my attempt at fixing your issue, if this doesn't work, please provide me with more info, and any errors in the output log.

script.Parent.MouseButton1Click:connect(function()
	local c = game.ReplicatedStorage.Purchasables.Other.B1.["Model"]:Clone();
        c.Parent = workspace; -- If you need this to be parented somewhere else, change this value
	c:MoveTo(character.torso)
end)

Now if this doesn't work, Obviously you are doing something wrong, and I would then ask:

####What's ["Model"]? Is it an object? If the object itself is a model you don't need to do this.

2 comments

0

inside the model that i want to spawn,it have some scripts and the part,in the code i select the entire model or just the part?

0

if you want to spawn an entire model you just list it's name, example Part has Part.SomeOtherPart, just do Part.Parent = X and it will copy both objects exactly how they are

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