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

How to clone a tool from replicated storage into your starter pack when you click a button? gui

hello thanks for looking at this post. so here are the details, how do you make it to when you click a button it removes the current tools that you have in your starter pack then it clones another set from replicated storage. Thanks:)

1 answer

✓ Accepted answer
--Example with a TextButton:

local button -- type here where the button is
local plr = game:GetService('Players').LocalPlayer

local tool -- type here the tool that you want to replicate when the other tool is deleted

button.Activated:Connect(function()
plr.Backpack:FindFirstChildWhichIsA('Tool'):Destroy()
local clone = tool:Clone()
clone.Parent = plr.Backpack
end)

2 comments

0

It doesent work and nothing showed up in the output, maybe I put the script in the wrong place isint it supposed to be the child of the textbutton?

0

nevermind I just fixed it, Thanks :)

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