The code below is meant to give the SlectionBox Adornee to the Target.
ERROR: Players.Player1.Backpack.Pickup_Check:14: bad argument #3 to 'Adornee' (Object expected, got string)
Code:
Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
GrabValue = Player.Backpack.Grab_.V_Grab
mouse.Move:connect(function()
local Target = mouse.Target
if Target ~= nil then
if Target.Name == "PickupItem_" or Target.Name == "Bag" then
Player.PlayerGui.SelectionBox.Adornee = Target
Player.Backpack.Grab_.Disabled = false
Player.PlayerGui.G_Hint.MainFrame.Visible = true
else
Player.PlayerGui.SelectionBox.Adornee = ""
Player.Backpack.Grab_.Disabled = true
Player.PlayerGui.G_Hint.MainFrame.Visible = false
GrabValue.Value = 0
end
end
end)
GrabValue.Changed:connect(function()
if GrabValue.Value == 5 then
local Target = mouse.Target
if Target ~= nil then
Target:Destroy()
end
end
end) |