rewdew2
|
  |
| Joined: 10 Dec 2009 |
| Total Posts: 168 |
|
|
| 19 Jul 2013 05:24 PM |
so i'm working on an ammo GUI and i need help (surprise surprise.) what i'm trying to do is make a script that will show your ammo on the ammo gui when you equip the weapon
Here's what i thought would work.
___________________________code_____________ player = script.Parent.Parent.Parent gui = player.PlayerGui.AmmoGUI tool = script.Parent ammo = script.Parent.AmmoScript.Ammo clip = script.Parent.AmmoScript.Clip
function onEquipped() gui.Frame.Ammo.Text = "Ammo: "..ammo.Value.."." gui.Frame.Clip.Text = "Clip: "..clip.Value.."." wait() end script.Parent.Equipped:connect(onEquipped)
_____________________________________________ But it doesn't. and i don't know why. (i'm not an expert with Lua)
Now, i have the GUIs set up properly. i tried one where it said
_______________________code___________________ (parents equal stuff here)
while true do gui.Frame.Ammo.Text = "Ammo: "..ammo.Value.."." gui.Frame.Clip.Text = "Clip: "..clip.Value.."." wait() end
______________________________________________
That worked fine until the player dies. in which case it goes back to saying "Label" (the default text i have it set to)
I've looked at tutorials, and nothing has helped me. PLEASE help?!
|
|
|
| Report Abuse |
|
|
Zkiller11
|
  |
| Joined: 25 Aug 2009 |
| Total Posts: 2914 |
|
|
| 19 Jul 2013 05:34 PM |
player = script.Parent.Parent.Parent gui = player.PlayerGui.AmmoGUI tool = script.Parent ammo = script.Parent.AmmoScript.Ammo clip = script.Parent.AmmoScript.Clip
function onEquipped() gui.Frame.Ammo.Text = "Ammo: "..ammo.Value.."." gui.Frame.Clip.Text = "Clip: "..clip.Value.."." wait() end script.Parent.Equipped:connect(onEquipped)
I'm guessing this script is located in the Tool, correct? Also, why do you declare tool, and then never use it again? Do you have any output? |
|
|
| Report Abuse |
|
|
icanxlr8
|
  |
| Joined: 25 Feb 2009 |
| Total Posts: 3686 |
|
|
| 19 Jul 2013 05:34 PM |
Try setting a time for wait. The only other odd thing could be this: script.Parent.Equipped might need to be tool.Equipped, as it may be confusing the script.
{You Want It, Ican Build It} |
|
|
| Report Abuse |
|
|
rewdew2
|
  |
| Joined: 10 Dec 2009 |
| Total Posts: 168 |
|
|
| 19 Jul 2013 05:38 PM |
Yeah, if you could throw it together in a better format, that'd be great.
And the reason other things were figured into was because that i MIGHT need to expand on the script, but i wasn't sure. |
|
|
| Report Abuse |
|
|