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 it so the weapon can be fetched from ReplicatedStorage?

local box = script.Parent.Parent:WaitForChild('TextBox')
local button = script.Parent
local code = "freegun"
local tries = 0
local maxtries = 99999999
local player = game.Players.LocalPlayer 
button.MouseButton1Down:connect(function()
    if box.Text == code then
        wait()
        box.Text = "Code Accepted"
        local tool = script.Parent:WaitForChild("Tool"):Clone()
        tool.Parent = player.Backpack 
    else
        wait()
        button.Text = "Incorrect Code"
        tries = tries + 1
    end
end)

The tool is currently the child of a text button. I would like the tool to be in ReplicatedStorage. What changes do I need to add in my script?

2 comments

2

wiki.roblox.com

0

Where's this script placed in?

1 answer

✓ Accepted answer

take

local tool = script.Parent:WaitForChild("Tool"):Clone()

and turn it into

local tool = game.ReplicatedStorage:WaitForChild("Tool"):Clone()

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