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

How to combine these two Scripts?

Asked by 3 years ago

I have this code

1local plr = game:GetService('Players').LocalPlayer
2    local backpack = plr:WaitForChild("Backpack")
3 
4    for i, v in pairs(backpack:GetChildren()) do
5        if v:IsA("Tool") then
6            v:Destroy()
7        end
8    end

that was given to me by ColdFoxy07(big thanks) and I have This code that I edited

01local cooldown = false --//r
02    local button = script.Parent
03    local plr = game:GetService('Players').LocalPlayer
04    local tool = game.ReplicatedStorage.ACS_Engine.HOOD["Micro UZI"]
05 
06    button.Activated:Connect(function()
07        if cooldown == false then
08            cooldown = true
09        script.Parent.Parent.Visible = false
10        plr.Backpack:FindFirstChildWhichIsA('Tool'):Destroy()
11        local clone = tool
12        clone.Parent = plr.Backpack
13        wait(0.5)
14        script.Parent.Parent.Parent.ClassH.Visible = true
15        wait(3)
16            script.Parent.Parent.Parent.ClassH.Visible = false
17            cooldown = false
18            end
19        end)

and Im trying to put the two together. but it doesent work here is the code( that I made trying to put the two together)

01local cooldown = false --//r
02    local button = script.Parent
03    local plr = game:GetService('Players').LocalPlayer
04    local tool = game.ReplicatedStorage.ACS_Engine.HOOD["Micro UZI"]
05local backpack = plr:WaitForChild("Backpack")
06 
07    button.Activated:Connect(function()
08        if cooldown == false then
09            cooldown = true
10        script.Parent.Parent.Visible = false
11     for i, v in pairs(backpack:GetChildren()) do
12        if v:IsA("Tool") then
13            v:Destroy()
14        local clone = tool
15        clone.Parent = plr.Backpack
View all 23 lines...

Could anyone help thanks!

1 answer

Log in to vote
0
Answered by 3 years ago

Hey again! Hopefully I fixed it for you;

01local cooldown = false --//r
02    local button = script.Parent
03    local plr = game:GetService('Players').LocalPlayer
04    local tool = game.ReplicatedStorage.ACS_Engine.HOOD["Micro UZI"]
05    local backpack = plr:WaitForChild("Backpack")
06 
07 
08    button.Activated:Connect(function()
09        if cooldown == false then
10            cooldown = true
11        script.Parent.Parent.Visible = false
12        for i, v in pairs(backpack:GetChildren()) do
13        if v:IsA("Tool") then
14            v:Destroy()
15        end
View all 25 lines...
1
Dude your a legend!!!! thanks! Iownrobloxp 44 — 3y
0
Thanks :) ColdFoxy07 76 — 3y
Ad

Answer this question