darkwisp
|
  |
| Joined: 07 Apr 2010 |
| Total Posts: 22653 |
|
|
| 16 Nov 2013 11:02 AM |
The parent is PlayerGui
Player = script.Parent.Parent.Parent.Parent.Parent
while wait() do Human = Player.Character.Humanoid Gun = Player.Character.Devastator Bar.Size = UDim2.new(( Gun.Handle.Ammo.Value / 6) * 1,0,1,0) end
[::Group in progress::] http://web.roblox.com/My/Groups.aspx?gid=973579 |
|
|
| Report Abuse |
|
|
Quorum
|
  |
| Joined: 25 Oct 2013 |
| Total Posts: 4680 |
|
|
| 16 Nov 2013 11:06 AM |
1) I'd use a LocalScript (easier to get the player). 2) I'd use the 'Changed' event, instead of a loop. 3) You should check to see if the gun is there, before running the code. Or, only running when the weapon is there. |
|
|
| Report Abuse |
|
|
darkwisp
|
  |
| Joined: 07 Apr 2010 |
| Total Posts: 22653 |
|
|
| 16 Nov 2013 11:13 AM |
How should I conduct the Changed event?
[::Group in progress::] http://web.roblox.com/My/Groups.aspx?gid=973579 |
|
|
| Report Abuse |
|
|
Quorum
|
  |
| Joined: 25 Oct 2013 |
| Total Posts: 4680 |
|
|
| 16 Nov 2013 11:22 AM |
Example, based on your code (assuming everything is defined).
Gun.Handle.Ammo.Changed:connect(function(NewVal) Bar.Size = UDim2.new(( NewVal / 6) * 1,0,1,0) end)
|
|
|
| Report Abuse |
|
|
darkwisp
|
  |
| Joined: 07 Apr 2010 |
| Total Posts: 22653 |
|
|
| 16 Nov 2013 11:32 AM |
Player = script.Parent.Parent.Parent.Parent.Parent Bar = script.Parent tool = script.Parent.Parent.Parent.Parent tool.Equipped:connect(function(mouse) Player.Character.Devastator.Handle.Ammo.Value.Changed:connect(function(change) Human = Player.Character.Humanoid Gun = Player.Character.Devastator Bar.Size = UDim2.new(( Gun.Handle.Ammo.Value / 6) * 1,0,1,0) end) end)
[::Group in progress::] http://web.roblox.com/My/Groups.aspx?gid=973579 |
|
|
| Report Abuse |
|
|