Hi! Recently i’ve been working on a new gam- “experience” where you need to deliever pizzas to make customers happy. How do i clone a tool?
I tried
script.Parent:Clone()
but it wont seem to work. How do i do this?
P.S = Going to bed now, 8:10 AM in the morning, i am a late sleeper. Hope to see your questions tommorow!
anxyeity
(user918561)
July 28, 2022, 12:11pm
#2
There should be no problems with your code, unless you’re not actually referencing the tool and script.Parent
is nil.
ayoub50
(Ayoub)
July 28, 2022, 12:13pm
#3
its because you’re not setting the parent of the tool
local Tool = script.Parent:Clone()
Tool.Parent = workspace -- for example
Assign that code to a variable, then parent the variable to where you want it.
local clone = script.Parent:Clone()
clone.Parent = game:GetService("StarterPack")
local toolClone = script.Parent:Clone()
toolClone.Parent = --Where you want to parent it.
Studio crashed. Studio crashed on almost ALL your solutions.
qxseb
(seb)
July 28, 2022, 7:41pm
#7
script.Parent:Clone().Parent = workspace
seems to work for me.
You either do:
local clone = script.Parent:Clone()
clone.Parent = workspace
or the version I’ve shown before. It’s the same thing and works the same way.
Yeah, but my studio crashed while doing almost everyones script.
qxseb
(seb)
July 28, 2022, 8:08pm
#10
How are you willing to clone the tool? By clicking a UI button? Touching the tool?
Normally, but i need to make it arrive at it’s starting point, because the pizzas are…
I thought that was the morning.
If your tool is placed in an area where scripts won’t run, that’s most likely your solution.
That’s because the script is inside the tool. Place the script outside the tool.
ToolClone = script.Parent.Tool:Clone()
while task.wait(3) do
local clone = ToolClone:Clone()
clone.Parent = workspace
game:GetService("Debris"):AddItem(clone, 15)
end
and make sure the script isn’t cloned with it.
Wdym by “Outside the tool”
The script.Parent
property must not be parented to any descendant of the tool.
So, where do i place the script in explorer?
I’m not sure. You didn’t provide me with enough info. Just make it the parent the same parent the tool has.
That’s the opposite of what I said…
Don’t put the script inside of the tool.
Ah, put it into workspace?````
Yeah. Put both the tool and script into workspace. The tool also must be named “Tool” as well.