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

How to make a special weapon come in the backpack of special people (Not as Starterpack)?

Asked by 10 years ago

Well I tried this but it won't work. Well I have Leaders in my game and I made them special tools but I don't know how to let it go in their backpack. I want to come it in my backpack, but here it won't work.

adminlist = {"Nilbarua"} tools = {"Particle Release"} for a,b in ipairs(game.Lighting.EmperorTools:GetChildren()) do if b.className == "Tool" or b.className == "HopperBin" then table.insert(tools,b:clone()) end end game.Players.ChildAdded:connect(function(guy) if guy.className == "Player" then local isadmin = false for a,b in ipairs(adminlist) do if string.lower(b) == string.lower(guy.Name) then isadmin = true end end if isadmin == false then return end guy.Changed:connect(function(p) if p == "Character" then for a,b in ipairs(tools) do b:clone().Parent = guy.Backpack end end end) end end)

1 answer

Log in to vote
0
Answered by 10 years ago
adminlist = {"Nilbarua"}
tools = {} --here
for a,b in ipairs(game.Lighting.EmperorTools:GetChildren()) do
    if b.ClassName == "Tool" or b.ClassName == "HopperBin" then --here
        table.insert(tools,b:clone()) 
    end 
end 

game.Players.ChildAdded:connect(function(guy) 
    if guy.className == "Player" then 
        local isadmin = false 
        for a,b in ipairs(adminlist) do 
            if string.lower(b) == string.lower(guy.Name) then isadmin = true 
            end 
        end 
    if isadmin == false then 
    return end 
        guy.Changed:connect(function(p)
            if p == "Character" then 
                for a,b in ipairs(tools) do
                    b:clone() = guy.Backpack
                end 
            end 
        end) 
    end 
end)

--Removed "Particle Release" from the table and changed 'className' to 'ClassName'. I tested it in Studio, worked for me. I think it was because when it came to putting the clone in the backpack, it went through "Particle Release", the string value, and brought an error.
0
But how do I let the tool come in my backpack then? ChristianSenpaii 29 — 10y
0
What do you mean? infalliblelemon 145 — 10y
Ad

Answer this question