whats Output?
and also i need help on this script that, when you click, it makes a tool appear inside your backpack, and if you have a tool that was spawned inside it...
it would be removed
on this part....
if(children[i].className == "HopperBin" )
it said only hopperbin
so it would select tools without a handle
so i edited it to this
if(children[i].className == "HopperBin" or children[i].className == "Tool")
i tested
DID NOT WORK
not even hopperbin worked!
i need help on it
PLEASE HELP!
HERE IS THE WHOLE THING
local bin = script.Parent
mode = 0
weapons = {}
children = bin:children()
for i=1,#children do
if(children[i].className == "HopperBin" or children[i].className == "Tool")
table.insert(weapons,children[i])
end
end
table.sort(weapons,
function (obj1, obj2)
if(obj1.Name < obj2.Name) then return true end
return false
end
)
curTool = weapons[1].Name
function onButton1Down(mouse)
mode = mode + 1
giveTool()
end
function giveTool()
local player = game.Players.LocalPlayer
if player == nil then return end
print("trigger")
if(player.Backpack:findFirstChild(curTool) ~= nil) then player.Backpack[curTool]:remove() end
if(mode > #weapons) then mode = 1 end
if(mode < 1) then mode = #weapons end
weapons[mode]:clone().Parent = player.Backpack
curTool = weapons[mode].Name
end
function keyDown(key)
print(key)
if(key == "q") then
mode = mode - 1
giveTool()
end
end
function onSelected(mouse)
print("select")
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.KeyDown:connect(keyDown)
end
bin.Selected:connect(onSelected) |