In my backpack GUI I have, that’s supposed to be from 2006-2010, I’m trying to add support for HopperBins, regardless if they’re depricated or not. It shows up in the GUI if you have it, but it doesn’t equip in the player. I have the code working, and the Output doesn’t say anything. I could appreciate help with this. I even tried a regular tool with the HopperBin’s script in it, unchecked “RequiresHandle”, and still nothing. Anyway. Here’s the code. Try to Ctrl + F for “HopperBin”.
local Player = Game:GetService('Players').LocalPlayer
local Mouse = Player:GetMouse()
local Camera = Game:GetService('Workspace').CurrentCamera
local function WaitForChild(Parent, Child)
if Parent:FindFirstChild(Child) then return Parent[Child] else
while true do
if Parent:FindFirstChild(Child) then return Parent[Child] end
Parent.ChildAdded:wait()
end
end
end
coroutine.resume(coroutine.create(function()
local Blocked = {'PlayerList', 'Backpack', 'Health'}
while true do -- just to be safe :-)
for Index, Core in pairs(Blocked) do
Game:GetService('StarterGui'):SetCoreGuiEnabled(Core, false)
end
wait()
end
end))
local Last
local Tools = {}
local AmountOfTools = 0
local function CreateTool(Name, ToolIcon, Parent)
local Button = Instance.new('TextButton', Parent)
Button.Name = Name
Button.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 / 255)
Button.BorderColor3 = Color3.new(0, 1, 0)
Button.BackgroundTransparency = 0.3
Button.BorderSizePixel = 0
Button.Size = UDim2.new(0, 94, 0, 85)
if ToolIcon ~= '' then
Button.Text = ''
Button.AutoButtonColor = false
else
Button.Text = Name
Button.Font = 'Cartoon'
Button.FontSize = 'Size18'
Button.TextColor3 = Color3.new(1, 1, 1)
Button.TextStrokeColor3 = Color3.new(108 / 255, 108 / 255, 108 / 255)
Button.TextStrokeTransparency = 0
Button.TextXAlignment = 'Left'
Button.AutoButtonColor = false
end
AmountOfTools = AmountOfTools + 1
if ToolIcon ~= '' then
local Image = Instance.new('ImageLabel', Button)
Image.Image = ToolIcon
Image.BorderSizePixel = 0
Image.BackgroundTransparency = 1
Image.Position = UDim2.new(0, 18, 0, 15)
Image.Size = UDim2.new(0, 60, 0, 60)
Image.ZIndex = 9
local HoverFrame = Instance.new('Frame', Button)
HoverFrame.Name = 'HoverFrame'
HoverFrame.BorderSizePixel = 0
HoverFrame.BackgroundTransparency = 1
HoverFrame.BackgroundColor3 = Color3.new(1, 1, 0)
HoverFrame.Position = UDim2.new(0, 18, 0, 15)
HoverFrame.Size = UDim2.new(0, 60, 0, 60)
HoverFrame.ZIndex = 8
end
local ButtonNumber = Instance.new('TextLabel', Button)
ButtonNumber.Name = 'Num'
ButtonNumber.BackgroundColor3 = Color3.new(168 / 255, 168 / 255, 168 / 255)
ButtonNumber.BorderSizePixel = 0
ButtonNumber.ZIndex = 10
ButtonNumber.Position = UDim2.new(0, 1, 0, 70)
ButtonNumber.Size = UDim2.new(0, 15, 0, 15)
ButtonNumber.Font = 'Cartoon'
ButtonNumber.FontSize = 'Size14'
ButtonNumber.Text = AmountOfTools..' '
ButtonNumber.TextColor3 = Color3.new(1, 1, 1)
table.insert(Tools, Button)
Tools[AmountOfTools] = Button -- lol
if Last == nil then
Button.Position = UDim2.new(0, 0, 1, -86)
Last = Button
else
Button.Position = Last.Position + UDim2.new(0, 94, 0, 0)
Last = Button
end
end
local GUI = Instance.new('ScreenGui', Player.PlayerGui)
local ToolHolder = Instance.new('Frame', GUI)
ToolHolder.Name = 'Tools'
ToolHolder.Size = UDim2.new(1, 0, 1, 0)
ToolHolder.BackgroundTransparency = 1
for _, Item in pairs(Player.Backpack:GetChildren()) do
if Item:IsA('Tool') or Item:IsA('HopperBin') then
CreateTool(Item.Name, Item.TextureId, ToolHolder)
end
end
for _, Button in pairs(ToolHolder:GetChildren()) do
if Button:IsA('TextButton') then
Button.MouseButton1Click:connect(function()
if Player.Backpack:FindFirstChild(Button.Name) then
for _, Item in pairs(Player.Character:GetChildren()) do
if Item:IsA('Tool') or Item:IsA('HopperBin') then
Item.Parent = Player.Backpack
ToolHolder:FindFirstChild(Item.Name).BorderSizePixel = 0
end
end
Player.Character.Humanoid:EquipTool(Player.Backpack:FindFirstChild(Button.Name))
Button.BorderSizePixel = 3
elseif Player.Character:FindFirstChild(Button.Name) then
Player.Character:FindFirstChild(Button.Name).Parent = Player.Backpack
Button.BorderSizePixel = 0
end
if Button:FindFirstChild('HoverFrame') then
Button.HoverFrame.BackgroundColor3 = Color3.new(0, 0, 1)
wait(0.04)
Button.HoverFrame.BackgroundColor3 = Color3.new(1, 1, 0)
end
end)
Button.MouseEnter:connect(function()
if Button:FindFirstChild('HoverFrame') then
Button.HoverFrame.BackgroundTransparency = 0
else
Button.BackgroundColor3 = Color3.new(180 / 255, 180 / 255, 180 /255)
end
end)
Button.MouseLeave:connect(function()
if Button:FindFirstChild('HoverFrame') then
Button.HoverFrame.BackgroundTransparency = 1
else
Button.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 /255)
end
end)
end
end
Mouse.KeyDown:connect(function(Key)
for Index, Tool in pairs(Tools) do
if tonumber(Key) == Index then
if Player.Backpack:FindFirstChild(Tool.Name) then
for _, Item in pairs(Player.Character:GetChildren()) do
if Item:IsA('Tool') or Item:IsA('HopperBin') then
Item.Parent = Player.Backpack
ToolHolder:FindFirstChild(Item.Name).BorderSizePixel = 0
end
end
Player.Character.Humanoid:EquipTool(Player.Backpack:FindFirstChild(Tool.Name))
ToolHolder:FindFirstChild(Tool.Name).BorderSizePixel = 3
elseif Player.Character:FindFirstChild(Tool.Name) then
Player.Character:FindFirstChild(Tool.Name).Parent = Player.Backpack
ToolHolder:FindFirstChild(Tool.Name).BorderSizePixel = 0
end
end
end
end)
local BarHolder = Instance.new('Frame', GUI)
BarHolder.Name = 'ToolbarThing'
BarHolder.BackgroundTransparency = 1
BarHolder.Size = UDim2.new(1, 0, 1, 0)
local ToolsButton = Instance.new('TextButton', BarHolder)
ToolsButton.Name = 'Tools'
ToolsButton.AutoButtonColor = false
ToolsButton.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 / 255)
ToolsButton.BackgroundTransparency = 0.3
ToolsButton.Size = UDim2.new(0, 100, 0, 25)
ToolsButton.Position = UDim2.new(0, 0, 0, -2)
ToolsButton.BorderSizePixel = 0
ToolsButton.Font = 'Cartoon'
ToolsButton.FontSize = 'Size18'
ToolsButton.Text = ' Tools'
ToolsButton.TextColor3 = Color3.new(204 / 255, 204 / 255, 204 / 255)
ToolsButton.TextTransparency = 0.1
ToolsButton.TextXAlignment = 'Left'
local InsertButton = Instance.new('TextButton', BarHolder)
InsertButton.Name = 'Insert'
InsertButton.AutoButtonColor = false
InsertButton.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 / 255)
InsertButton.BackgroundTransparency = 0.3
InsertButton.Size = UDim2.new(0, 100, 0, 25)
InsertButton.Position = UDim2.new(0, 100, 0, -2)
InsertButton.BorderSizePixel = 0
InsertButton.Font = 'Cartoon'
InsertButton.FontSize = 'Size18'
InsertButton.Text = 'Insert'
InsertButton.TextColor3 = Color3.new(204 / 255, 204 / 255, 204 / 255)
InsertButton.TextTransparency = 0.1
InsertButton.TextXAlignment = 'Left'
local FullscreenButton = Instance.new('TextButton', BarHolder)
FullscreenButton.Name = 'Fullscreen'
FullscreenButton.AutoButtonColor = false
FullscreenButton.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 / 255)
FullscreenButton.BackgroundTransparency = 0.3
FullscreenButton.Size = UDim2.new(0, 100, 0, 25)
FullscreenButton.Position = UDim2.new(0, 200, 0, -2)
FullscreenButton.BorderSizePixel = 0
FullscreenButton.Font = 'Cartoon'
FullscreenButton.FontSize = 'Size18'
FullscreenButton.Text = 'Fullscreen'
FullscreenButton.TextColor3 = Color3.new(0, 0, 0)
FullscreenButton.TextTransparency = 0.1
FullscreenButton.TextXAlignment = 'Left'
local HelpButton = Instance.new('TextButton', BarHolder)
HelpButton.Name = 'Help'
HelpButton.AutoButtonColor = false
HelpButton.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 / 255)
HelpButton.BackgroundTransparency = 0.3
HelpButton.Size = UDim2.new(0, 100, 0, 25)
HelpButton.Position = UDim2.new(0, 300, 0, -2)
HelpButton.BorderSizePixel = 0
HelpButton.Font = 'Cartoon'
HelpButton.FontSize = 'Size18'
HelpButton.Text = 'Help...'
HelpButton.TextColor3 = Color3.new(0, 0, 0)
HelpButton.TextTransparency = 0.1
HelpButton.TextXAlignment = 'Left'
local ExitButton = Instance.new('TextButton', BarHolder)
ExitButton.Name = 'Exit'
ExitButton.AutoButtonColor = false
ExitButton.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 / 255)
ExitButton.BackgroundTransparency = 0.3
ExitButton.Size = UDim2.new(0, 100, 0, 25)
ExitButton.Position = UDim2.new(0, 400, 0, -2)
ExitButton.BorderSizePixel = 0
ExitButton.Font = 'Cartoon'
ExitButton.FontSize = 'Size18'
ExitButton.Text = 'Exit'
ExitButton.TextColor3 = Color3.new(0, 0, 0)
ExitButton.TextTransparency = 0.1
ExitButton.TextXAlignment = 'Left'
local IsFullscreen = false
FullscreenButton.MouseButton1Click:connect(function()
IsFullscreen = not IsFullscreen
if IsFullscreen then
FullscreenButton.Text = 'x Fullscreen'
else
FullscreenButton.Text = 'Fullscreen'
end
end)
ExitButton.MouseButton1Click:connect(function()
Player:Kick()
end)
-- health
local HealthHolder = Instance.new('Frame', GUI)
HealthHolder.Name = 'Health'
HealthHolder.Size = UDim2.new(1, 0, 1, 0)
HealthHolder.BackgroundTransparency = 1
local Background = Instance.new('Frame', HealthHolder)
Background.BackgroundColor3 = Color3.new(217 / 255, 0, 0)
Background.Name = 'Background'
Background.BorderSizePixel = 0
Background.Position = UDim2.new(1, -50, 0.5, -75)
Background.Size = UDim2.new(0, 8, 0, 150)
local HealthBar = Instance.new('Frame', Background)
HealthBar.Name = 'HealthBar'
HealthBar.BackgroundColor3 = Color3.new(91 / 255, 173 / 255, 47 / 255)
HealthBar.BorderSizePixel = 0
HealthBar.Size = UDim2.new(0, 8, 0, 150)
local HealthLabel = Instance.new('TextLabel', Background)
HealthLabel.Name = 'Label'
HealthLabel.BackgroundColor3 = Color3.new(13 / 255, 105 / 255, 173 / 255)
HealthLabel.Position = UDim2.new(0, 3, 1, 10)
HealthLabel.Size = UDim2.new(0, 0, 0, 0)
HealthLabel.Font = 'Cartoon'
HealthLabel.FontSize = 'Size18'
HealthLabel.Text = 'Health'
HealthLabel.TextColor3 = Color3.new(0, 0, 1)
local Character = WaitForChild(Game:GetService('Workspace'), Player.Name)
local Humanoid = WaitForChild(Character, 'Humanoid')
Humanoid.Changed:connect(function()
HealthBar.Size = UDim2.new(0, 8, 0, (Humanoid.Health * 1.5))
HealthBar.Position = UDim2.new(0, 0, 0, ((100 - Humanoid.Health) * 1.5))
end)
-- now we'll move on to the playerlist :)
-- ** NOTE TO SELF: ** make playerlist compatible with teams & leaderstats
local Playerlist = Instance.new('Frame', GUI)
Playerlist.Name = 'PlayerList'
Playerlist.Size = UDim2.new(1, 0, 1, 0)
Playerlist.BackgroundTransparency = 1
local TitleThingy = Instance.new('Frame', Playerlist)
TitleThingy.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 / 255)
TitleThingy.BackgroundTransparency = 0.3
TitleThingy.BorderSizePixel = 0
TitleThingy.Position = UDim2.new(1, -251, 0, 5)
TitleThingy.Size = UDim2.new(0, 250, 0, 35)
local TitleText = Instance.new('TextLabel', TitleThingy)
TitleText.Size = UDim2.new(0, 250, 0, 20)
TitleText.Font = 'Cartoon'
TitleText.FontSize = 'Size36'
TitleText.TextColor3 = Color3.new(1, 1, 1)
TitleText.Text = 'Players'
TitleText.TextXAlignment = 'Left'
TitleText.BackgroundTransparency = 1
local List = Instance.new('Frame', Playerlist)
List.Name = 'List'
List.BackgroundTransparency = 1
List.Position = UDim2.new(1, -322, 0, 40)
List.Size = UDim2.new(0, 0, 0, 0)
local NameColors = {
BrickColor.new('Bright red'),
BrickColor.new('Bright blue'),
BrickColor.new('Earth green'),
BrickColor.new('Bright violet'),
BrickColor.new('Bright orange'),
BrickColor.new('Bright yellow'),
BrickColor.new('Light reddish violet'),
BrickColor.new('Brick yellow')
}
local GetNameValue
local function GetNameValue(Name)
local Length = #Name
local Value = 0
for Index = 1, Length do
local CharacterValue = string.byte(string.sub(Name, Index, Index))
local ReverseIndex = Length - Index + 1
if Length % 2 == 1 then
ReverseIndex = ReverseIndex - 1
end
if ReverseIndex % 4 >= 2 then
CharacterValue = -CharacterValue
end
Value = Value + CharacterValue
end
return Value % 8
end
local function GetChatColor(Name)
return NameColors[GetNameValue(Name) + 1]
end
local LastLabel
for v = 1, 20 do
local Label = Instance.new('TextLabel', List)
Label.Name = 'Label'..v
Label.BackgroundColor3 = Color3.new(163 / 255, 163 / 255, 163 / 255)
Label.BackgroundTransparency = 0.3
Label.BorderSizePixel = 0
Label.Size = UDim2.new(0, 250, 0, 20)
Label.Visible = false
Label.Font = 'Cartoon'
Label.FontSize = 'Size14'
Label.TextColor3 = Color3.new(1, 1, 1)
Label.TextXAlignment = 'Left'
if LastLabel == nil then
Label.Position = UDim2.new(0, 71, 0, 0)
LastLabel = Label
else
Label.Position = LastLabel.Position + UDim2.new(0, 0, 0, 20)
LastLabel = Label
end
end
local Player = {}
local Players = Game:GetService('Players'):GetChildren()
local function UpdateList()
local Labels = List:GetChildren()
for Index = 1, #Labels do
if Labels[Index]:IsA('TextLabel') then
Labels[Index].Visible = false
end
end
for Index = 1, #Player do
Label = List:FindFirstChild('Label'..tostring(Index))
if Label then
Label.Visible = true
Label.Text = Player[Index].Name
Label.TextColor3 = GetChatColor(Player[Index].Name).Color
end
end
end
local function GetNumber(obj)
for Index = 1, #Player do
if Player[Index] == obj then
return Index
end
end
end
for Index = 1, #Players do
table.insert(Player, Players[Index])
end
UpdateList()
Game:GetService('Players').ChildAdded:connect(function(Plr) table.insert(Player, Plr) UpdateList() end)
Game:GetService('Players').ChildRemoved:connect(function(Plr) table.remove(Player, GetNumber(Plr)) UpdateList() end)
-- camera stuff
local CameraStuff = Instance.new('Frame', GUI)
CameraStuff.Name = 'Camera stuff'
CameraStuff.Size = UDim2.new(1, 0, 1, 0)
CameraStuff.BackgroundTransparency = 1
local CameraZoomOut = Instance.new('ImageButton', CameraStuff)
CameraZoomOut.Name = 'CameraZoomOut'
CameraZoomOut.BackgroundTransparency = 1
CameraZoomOut.Image = 'http://www.roblox.com/asset/?id=2297038'
CameraZoomOut.Position = UDim2.new(1, -55, 1, -30)
CameraZoomOut.Size = UDim2.new(0, 20, 0, 20)
local CameraZoomIn = Instance.new('ImageButton', CameraStuff)
CameraZoomIn.Name = 'CameraZoomIn'
CameraZoomIn.BackgroundTransparency = 1
CameraZoomIn.Image = 'http://www.roblox.com/asset/?id=2297035'
CameraZoomIn.Position = UDim2.new(1, -55, 1, -50)
CameraZoomIn.Size = UDim2.new(0, 20, 0, 20)
local CameraTiltUp = Instance.new('ImageButton', CameraStuff)
CameraTiltUp.Name = 'CameraTiltUp'
CameraTiltUp.BackgroundTransparency = 1
CameraTiltUp.Image = 'http://www.roblox.com/asset/?id=33180892'
CameraTiltUp.Position = UDim2.new(1, -75, 1, -50)
CameraTiltUp.Size = UDim2.new(0, 20, 0, 20)
local CameraTiltDown = Instance.new('ImageButton', CameraStuff)
CameraTiltDown.Name = 'CameraTiltDown'
CameraTiltDown.BackgroundTransparency = 1
CameraTiltDown.Image = 'http://www.roblox.com/asset/?id=33180917'
CameraTiltDown.Position = UDim2.new(1, -75, 1, -30)
CameraTiltDown.Size = UDim2.new(0, 20, 0, 20)
CameraTiltUp.MouseButton1Click:connect(function() -- these are pretty glitchy - i probably won't fix them because i'm lazy
Camera.CoordinateFrame = CFrame.new(Camera.CoordinateFrame.X, Camera.CoordinateFrame.Y - 5, Camera.CoordinateFrame.Z)
end)
CameraTiltDown.MouseButton1Click:connect(function()
Camera.CoordinateFrame = CFrame.new(Camera.CoordinateFrame.X, Camera.CoordinateFrame.Y + 5, Camera.CoordinateFrame.Z)
end)
while true do
local Magnitude = (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude
if Magnitude <= 4 then
ZoomHelp.Visible = true
elseif Magnitude > 4 then
ZoomHelp.Visible = false
end
wait()
end