Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Scroll wheel tool change broken, can someone help? [closed]

Asked by
Launderer 343 Moderation Voter
7 years ago
Edited by Pyrondon 7 years ago

Can someone tell me whats wrong with this fix and possibly fix it. I did not make this script btw but I really need it to work. It's supposed to cycle through tools with use of scroll wheel. The forward wheel works with switching weapons, but the scrollwheel back unequips all tools and doesn't equip a new one.

01local player = game.Players.LocalPlayer
02local char = player.Character or player.CharacterAdded:wait()
03game:GetService("UserInputService").InputChanged:connect(function(iO,gPE)
04    if not gPE then
05        if iO.UserInputType == Enum.UserInputType.MouseWheel then
06            print(iO.Position.Z)
07            local LastTool = nil
08            local Pos = 1
09            for i,v in pairs(char:GetChildren())do
10                if v:IsA'Tool'then
11                    LastTool = v
12                end
13            end
14            char.Humanoid:UnequipTools()
15            for i,v in pairs(player.Backpack:GetChildren())do
View all 43 lines...
0
Woah, I do not know why the script came out like that... Launderer 343 — 7y
0
Edited for code block. In the future, be sure to enclose your code in a code block by highlighting your code and clicking the blue Lua button included in the editor. Pyrondon 2089 — 7y
0
Stopped reading at "I did not make this script". Goulstem 8144 — 7y

Closed as Not Constructive by Goulstem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?