Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-3

How do I make it so the weapon can be fetched from ReplicatedStorage?

Asked by 7 years ago
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
wiki.roblox.com INOOBE_YT 387 — 7y
0
Where's this script placed in? TheeDeathCaster 2368 — 7y

1 answer

Log in to vote
1
Answered by
INOOBE_YT 387 Moderation Voter
7 years ago

take

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

and turn it into

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

Ad

Answer this question