This script is supposed to switch between tools when a player uses their mouse to scroll up/down. However, the script is not working, and I have no idea why. I do not have FilteringEnabled on, and output isn't giving me anything.
Can someone please help me? Here's the script:
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local Backpack = Player:WaitForChild("Backpack") Mouse.WheelForward:connect(function() local hi = Player.Character:GetChildren() for i = 1, #hi do if hi[i].ClassName == "Tool" then if hi[i].On.Value == true then hi[i].On.Value = false end end end local children = Backpack:GetChildren() for i = 1, #children do if children[i].ClassName == "Tool" then if children[i].On.Value == false then Player.Character.Humanoid:EquipTool(Player:WaitForChild("Backpack"):WaitForChild(children[i])) children[i].On.Value = true end end end end) Mouse.WheelBackward:connect(function() local hi = Player.Character:GetChildren() for i = 1, #hi do if hi[i].ClassName == "Tool" then if hi[i].On.Value == true then hi[i].On.Value = false end end end local children = Backpack:GetChildren() for i = 1, #children do if children[i].ClassName == "Tool" then if children[i].On.Value == false then Player.Character.Humanoid:EquipTool(Player:WaitForChild("Backpack"):WaitForChild(children[i])) children[i].On.Value = true end end end end)