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

Cloning a object from a tool?

Asked by 5 years ago

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.

1
Do you mean like they get to pick the model or it just spawns in a random model? TypicallyPacific 61 — 5y
0
By using the Equipped event, I believe that it is possible. NicholasY4815 55 — 5y
0
totally possible DinozCreates 1070 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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)
Ad

Answer this question