generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Confusion

Previous Thread :: Next Thread 
cgjnm is not online. 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 is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
19 Mar 2016 11:31 PM
This is really hard to read..


Report Abuse
cgjnm is not online. 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 is not online. 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
badguy1233 is online. badguy1233
Joined: 23 Jul 2009
Total Posts: 885
19 Mar 2016 11:45 PM
for I=1,#Backpack:GetChildren() do
print(backpack:GetChildren()[i])
end
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
19 Mar 2016 11:48 PM
That does not help for this situation.
Report Abuse
chimmihc is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image