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 » Scripting Helpers
Home Search
 

Re: Confused with something

Previous Thread :: Next Thread 
Anya1917 is not online. Anya1917
Joined: 17 Aug 2011
Total Posts: 108
21 Aug 2012 08:36 PM

local Ammoval = script.parent.Ammo.Value

local ammgui = script.Parent.Parent.Parent.PlayerGui.Gunstuff.AM


while true do

wait (0.05)

ammogui = Ammoval

end


everything is in place, I believe in the while true do I'm tagging the ammogui as the ammoval, It's supposed to change text of Ammogui to the value of ammoval.

Bleh, I'm confused, Assistance please?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Aug 2012 08:36 PM
What is AM?

† KMXD †
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
21 Aug 2012 08:37 PM
ammogui is Nil, can't set a NumberValue to an Object Value.

gtg so I can't help More.
Report Abuse
Anya1917 is not online. Anya1917
Joined: 17 Aug 2011
Total Posts: 108
21 Aug 2012 08:37 PM
AM is a Text Box
Report Abuse
Anya1917 is not online. Anya1917
Joined: 17 Aug 2011
Total Posts: 108
21 Aug 2012 08:38 PM
ew, wait, I think I figured it out.

Needs to change text.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Aug 2012 08:39 PM
ammogui = tonumber(Ammoval.Text)

?

† KMXD †
Report Abuse
Anya1917 is not online. Anya1917
Joined: 17 Aug 2011
Total Posts: 108
21 Aug 2012 08:40 PM
Knight, I'm a really basic scripter, I just started not to long ago, Err, What exactly does that mean?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Aug 2012 08:42 PM
It would return the text into a number, but if it isn't a number it would be nil, so I would check if it could first, like:

if tonumber(Ammoval.Text) then

† KMXD †
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
21 Aug 2012 08:43 PM
Makes string into numbers

† KMXD 2.0 †
Report Abuse
Anya1917 is not online. Anya1917
Joined: 17 Aug 2011
Total Posts: 108
21 Aug 2012 08:47 PM
I have no clue,

The script is supposed to take the value of ammoval and change the text of ammogui to the value of ammoval, I'm really confused at the moment. Any way you could plainly explain this?
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
21 Aug 2012 08:49 PM
I think you just want to change the Gui's text to the value...

ammogui.Text = Ammoval

† KMXD 2.0 †
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Aug 2012 08:50 PM
Oh sorry, derped it all.

Do:

    local Ammoval = script.parent.Ammo.Value
    local ammogui = script.Parent.Parent.Parent.PlayerGui.Gunstuff.AM
    while true do
    wait (0.05)
    ammogui.Text = Ammoval
    end

Though using the .Changed event would be better.

† KMXD †
Report Abuse
Anya1917 is not online. Anya1917
Joined: 17 Aug 2011
Total Posts: 108
21 Aug 2012 08:52 PM
What's the .Changed event?

And knight, that's basically what I have in the script at the moment, however, it's not working. This is all in a tool, In the other thread I mentioned the hierarchy change. Is it a problem with the tagging process?
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Aug 2012 08:53 PM
You made a typo for the variable, and you weren't changing the actual text, but the instance itself, though I'm not sure why it wouldn't work.

† KMXD †
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Aug 2012 08:55 PM
Try this just in case:

while wait(0.05) do
script.Parent.Parent.Parent.PlayerGui.Gunstuff.AM.Text = script.parent.Ammo.Value
end

† KMXD †
Report Abuse
Anya1917 is not online. Anya1917
Joined: 17 Aug 2011
Total Posts: 108
21 Aug 2012 09:00 PM
That didn't work either. Something I forgot to mention, and I think might be the problem, It's a local script.

I don't see how that'd effect it though, From what I know the local script functions on the preson's computer rather then the roblox game.

Have no clue, I'm confused with this script.
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
21 Aug 2012 09:01 PM
while wait(0.05) do
Game.Players.LocalPlayer.PlayerGui.Gunstuff.AM.Text = script.parent.Ammo.Value
end

† KMXD 2.0 †
Report Abuse
Destroshun is not online. Destroshun
Joined: 12 Aug 2012
Total Posts: 764
21 Aug 2012 09:01 PM
Wait use this one


while wait(0.05) do
Game.Players.LocalPlayer.PlayerGui.Gunstuff.AM.Text = script.Parent.Ammo.Value
end

Knight left a parent as parent not Parent...

† KMXD 2.0 †
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Aug 2012 09:04 PM
That might have a been the problem, I must've missed it.

† KMXD †
Report Abuse
chickenlord is not online. chickenlord
Joined: 17 Nov 2008
Total Posts: 14717
21 Aug 2012 09:05 PM
Alright, Thanks a bunch guys. This helped a lot.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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