cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 19 Mar 2016 11:30 PM |
This should work right?:
if iO.Position.Z == 1 then if Pos == 1 then Pos = #player.Backpack:GetChildren() print(Pos)char.Humanoid:UnequipTools() char.Humanoid:EquipTool(player.Backpack:GetChildren()[Pos]) wait()
elseif Pos > 1 then Pos = Pos-1 print(Pos)char.Humanoid:UnequipTools() char.Humanoid:EquipTool(player.Backpack:GetChildren()[Pos]) wait() end
elseif iO.Position.Z == -1 then if Pos == #player.Backpack:GetChildren() then Pos = 1 print(Pos)char.Humanoid:UnequipTools() char.Humanoid:EquipTool(player.Backpack:GetChildren()[Pos]) wait()
elseif Pos < #player.Backpack:GetChildren() then Pos = Pos+1 print(Pos)char.Humanoid:UnequipTools() char.Humanoid:EquipTool(player.Backpack:GetChildren()[Pos]) wait() end end
Is there anything I'm doing wrong? |
|
|
| Report Abuse |
|
|
Laakari
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 17362 |
|
|
| 19 Mar 2016 11:31 PM |
This is really hard to read..
|
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 19 Mar 2016 11:36 PM |
Yes, I know :(
This script is supposed to change the tool that is equipped by using the mouse wheel.
The iO.Position.Z is the mouse wheel (1 is scrolling up, -1 is scrolling down)
The Pos changes each time the wheel moves, and when it prints while going up, it reads: 4,3,2,1,4,3,2,1...
prints while going down: 1,2,3,4,1,2,3,4
However, it does not go to the 4th,3rd,2nd and then the 1st...
It more-so goes like: 1,4,3,2,1,3.... |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 19 Mar 2016 11:40 PM |
| Visit: http://www.roblox.com/games/382297058/Gun-Making-Testing to see what I mean |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2016 11:45 PM |
for I=1,#Backpack:GetChildren() do print(backpack:GetChildren()[i]) end |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 19 Mar 2016 11:48 PM |
| That does not help for this situation. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 19 Mar 2016 11:53 PM |
UIS = game:GetService("UserInputService")
local ToolPos = 1
UIS.InputChanged:connect(function(Input) if Input.UserInputType == Enum.UserInputType.MouseWheel then local Children = player.Backpack:GetChildren() ToolPos = ToolPos - Input.Position.Z if ToolPos < 1 then ToolPos = #Children elseif ToolPos > #Children then ToolPos = 1 end local Tool = Children[ToolPos] if Tool then char.Humanoid:EquipTool(Tool) end end end)
|
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 19 Mar 2016 11:58 PM |
It still does the exact same thing :( Although I do like your efficiency :)
Visit: http://www.roblox.com/games/382297058/Gun-Making-Testing to see how it messes up |
|
|
| Report Abuse |
|
|