Ad
Log in to vote
0

Button Works once not multiple times? "parent property locked"

Asked by 1 month ago

So I have this button that grabs a tool from a folder than puts it into the starter pack (there are 30 tools in folder). and it only works once, I dont know why could anyone help?(ColdFoxy07 if you answer this again big susy)

local cooldown = false --//r
local button = script.Parent
local plr = game:GetService('Players').LocalPlayer

local tool = game.ReplicatedStorage.ACS_Engine.P2000GUN.P2000

button.Activated:Connect(function()
    if cooldown == false then
        cooldown = true
        script.Parent.Parent.Visible = false
        local clone = tool
        clone.Parent = plr.Backpack
        wait(0.5)
        script.Parent.Parent.Parent.TextLabel.Visible = true
        wait(3)
        script.Parent.Parent.Parent.TextLabel.Visible = false
        cooldown = false
    end
end)
0
ALSO THIS IS THE LAST QUESTION IM ASKING Iownrobloxp 44 — 1mo
0
the issue is that when you create the variable "tool" it only gets one tool and doesnt check for other ones if its not there. tightanfall 110 — 1mo
0
the best way to do it is to just clone. tightanfall 110 — 1mo
0
if I do clone the tool wont work, Im not sure why Iownrobloxp 44 — 1mo
0
Thanks for the comment, I fixed it myself by removing the tool variable and adjusting the clone variable. also thanks for pointing me twords the right direction with cloning, I probobly wouldve cloned the tool if it actually worked when cloned. Iownrobloxp 44 — 1mo

Answer this question