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

Why is my Giver Tool Gui not working? [Solved]

Asked by 10 years ago

The button is designed to become a one-use button, all of the parts of the script are working except the script doesn't give the tool it must give to player.

The output says that the line 12 attempts to use clone method (a nil value)

What's wrong with the localscript?

local button = script.Parent
local clicked = false

button.MouseButton1Click:connect(function(player)
    if not clicked then
        clicked = true
        if not game.ServerStorage:FindFirstChild("Tools") then
            local model = Instance.new("Model", game.ServerStorage)
            model.Name = "Tools"
        end
        local tools = game.ServerStorage.Tools:GetChildren()
        tools:Clone().Parent = button.Parent.Parent.Parent.Backpack
        button.Parent:Destroy()
        clicked = false
    end
end)

Answer this question