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

Cloning a object from a tool?

Hello all,

I really want to be able to spawn in models from a tool that can be given to the staff on my game. So when ever you click the tool it will clone a model from either server storage or replicated storage and place it on the floor where the player is standing.

Please tell me if its possible through a tool or if i will have to make a GUI for it.

3 comments

1

Do you mean like they get to pick the model or it just spawns in a random model?

0

By using the Equipped event, I believe that it is possible.

0

totally possible

1 answer

✓ Accepted answer

It is possible, here's how

Create a tool, I assume that when the player clicks and activates the tool it spawns in a model.

local Tool = Instance.new("Tool")

Tool.Activated:Connect(function()
end)

The code above creates a Tool which an event listener for when the player clicks with the tool equipped.

local Tool = Instance.new("Tool")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

-- Get the service so that you can access the models to clone from

Tool.Activated:Connect(function()

-- Clones the object named "Model", remember that this still doesn't have a parent
local Clone = ReplicatedStorage.Model:Clone()
Clone.Position = Vector3.new(0,0,0) -- You have to set it below the player, I would recommend using CFrame, but Vector3 is possible
Clone.Parent = game.Workspace
end)

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