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

how do i make a tool spawn in on button click?

ok so basicly i need help making a script that spawns a tool, on the click of a button. So what im guessing is you use :cloneBut i have no idea how. if you wanna help thanks if not uhhh have a nice day. thanks

2 comments

0

Is the button a UI or ClickDetector?

0

its a click detector

1 answer

✓ Accepted answer

Have whatever tool you want to clone in ServerStorage and use this:

local tool = game:GetService('ServerStorage')['Tool Name Here']
local click_detector = script.Parent -- Change this to wherever the click detector is located if needed

click_detector.MouseClick:Connect(function(player)
	tool:Clone().Parent = player.Backpack
end)

Replace the variables at the top with the correct references

2 comments

0

Also if you want the tool to be parented to workspace then just change where the parent is set

0

Thank you so much this helped :D

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