So what I'm trying to create is a tool where when clicked, it clones the tool and be nested in Workspace. When the model/tool is placed in Workspace and tested, it works fine.
The tool script is a localscript.
tool = script.Parent
tool.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
local firework = script.Parent.Firework:Clone()
firework.Parent = game.Workspace
firework.Anchored = true
firework.Position = mouse.hit.p + Vector3.new(0,1.511,0)
firework.Orientation = Vector3.new(0,math.random(0,360),0)
end)
end)
The script that is cloned and is nested in the firework is a normal script.
offset = 0
script.Parent.ClickDetector.MouseClick:connect(function()
print("Clicked")
wait(3)
script.Parent.Position = script.Parent.Position + Vector3.new(0,1.5,0)
script.Parent.Anchored = false
script.Parent.BodyForce.Force = Vector3.new(math.random(-offset,offset),0,math.random(-offset,offset))
wait(3)
script.Parent.Anchored = true
print("Hi!")
script.Parent:Destroy()
end)
The tool: http://prntscr.com/o6ckh8
When the tool clicks, it places the firework perfectly. But when it is clicked, nothing happens. It won't print too.
I'll add debounce, no worries.
