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: this should give me 10+ hunger

Previous Thread :: Next Thread 
skydude221 is not online. skydude221
Joined: 15 May 2013
Total Posts: 5014
29 Jan 2017 12:52 PM
but it doesn't :(((

food = 5
hungervalue = game.StarterGui.HUD.Hunger.Hunger.Hunger.Value

function clicked()
food = food - 1
script.Parent.Name = "Food " .. food .. "/5"
hungervalue = hungervalue + 10
if food == 0 then
script.Parent:Destroy()
end
end

script.Parent.Activated:connect(clicked)
Report Abuse
skydude221 is not online. skydude221
Joined: 15 May 2013
Total Posts: 5014
29 Jan 2017 01:06 PM
bump
Report Abuse
Wowgnomes is online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
29 Jan 2017 02:22 PM
sad


Report Abuse
Intended_Pun is not online. Intended_Pun
Joined: 10 Aug 2016
Total Posts: 4384
29 Jan 2017 02:24 PM
You're changing the variable, not the actual value:

food = 5
hungervalue = game.Players.LocalPlayer.PlayerGui.HUD.Hunger.Hunger.Hunger --Ugly. Learn about PlayerGui and WaitForChild() :)

function clicked()
food = food - 1
script.Parent.Name = "Food " .. food .. "/5"
hungervalue.Value = hungervalue.Value + 10
if food == 0 then
script.Parent:Destroy()
end
end

script.Parent.Activated:connect(clicked)
Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
29 Jan 2017 02:26 PM
I'm not sure this works but you can try it anyways, I've never really scripted much with Activated.

food = 5

function clicked(plr)
hungervalue = game.Players[plr.Name].PlayerGui.HUD.Hunger.Hunger.Hunger.Value
food = food - 1
script.Parent.Name = "Food " .. food .. "/5"
hungervalue = hungervalue + 10
if food == 0 then
script.Parent:Destroy()
end
end

script.Parent.Activated:connect(clicked)
Report Abuse
The_Envelope is not online. The_Envelope
Joined: 14 Jun 2016
Total Posts: 1592
29 Jan 2017 02:26 PM
what intended_pun said.


https://www.roblox.com/library/484206801/EnvelopeIcon
Report Abuse
skydude221 is not online. skydude221
Joined: 15 May 2013
Total Posts: 5014
30 Jan 2017 10:09 AM
thanks

how would you make this a waitforchild? im not very experienced on it in addresses
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