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

How can I let a special tool come in my backpack?

Asked by 10 years ago

Well I tried this from free models but nothing worked. I wanted to put a tool called Particle Release in it but I don't know how precisely. Please help me.

adminlist = {"Nilbarua"} tools = {} 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
Wrap your code in the `code block` syntax to make it readable. Ekkoh 635 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
adminlist = {"Nilbarua"}

game.Players.PlayerAdded:connect(function(np)
for _,v in pairs(adminlist) do
if v:lower() == np.Name:lower() then --if the name of the 'admin' is the same as the player
for ind,tool in pairs(game.Lighting.EmperorTools:GetChildren()) do --loop through the model of tools
tool:Clone().Parent = np.StarterGear --StarterGear gets cloned into the Backpack each time you spawn
end
break --exit the loop of the list of admin if there's a match, after you do the cloning
end
end
end)
0
I have something called Particle Release in it, so how can that be spawned in my backpack? ChristianSenpaii 29 — 10y
0
Oh, I see. I didn't read that you used free models, for this. You can either make a model in Lighting called EmperorTools and then put your tool in it, or you can modify the script to remove the second generic for loop and have it clone specifically that item, parenting it to your StarterGear. grimm343 30 — 10y
Ad

Answer this question