I am confused by the Output it is giving me, and why I am getting it, the Output keeps saying 22:01:14.903 - Players.Player1.Backpack.RESET.Reset:23: attempt to index upvalue 'namez' (a function value)
22:01:14.904 - Stack Begin
22:01:14.904 - Script 'Players.Player1.Backpack.RESET.Reset', Line 23
22:01:14.905 - Stack End
, but I don't know what to do to fix it, it worked for me before, I'm just now getting this error [note: this happens when you deselect the tool], here is the script;
--Reset HopperBin brought to you by TheeDeathCaster :D repeat wait() until game.Players.LocalPlayer local plr = game.Players.LocalPlayer repeat wait() until plr:GetMouse() local mouse = plr:GetMouse() local debounce = true local namez = function() if plr and mouse and mouse.Target and not mouse.Target.Locked and debounce then debounce = false print(mouse.Target.Name," is the name.") wait(.1) debounce = true end end local function Namez() print(script.Parent.Name.." equipped") mouse.Button1Down:connect(namez) end script.Parent.Selected:connect(Namez) script.Parent.Deselected:connect(function() namez:disconnect() end) --To keep from reseting even when unselected :)
You've accidentally used an , instead of .. in your print function. This should work:
--Reset HopperBin brought to you by TheeDeathCaster :D repeat wait() until game.Players.LocalPlayer local plr = game.Players.LocalPlayer repeat wait() until plr:GetMouse() local mouse = plr:GetMouse() local debounce = true local namez = function() if plr and mouse and mouse.Target and not mouse.Target.Locked and debounce then debounce = false print(mouse.Target.Name.." is the name.") wait(.1) debounce = true end end local function Namez() print(script.Parent.Name.." equipped") mouse.Button1Down:connect(namez) end script.Parent.Selected:connect(Namez) script.Parent.Deselected:connect(function() namez:disconnect() end) --To keep from reseting even when unselected :)