|
| 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 |
|
|
| |
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 29 Jan 2017 02:26 PM |
what intended_pun said.
https://www.roblox.com/library/484206801/EnvelopeIcon |
|
|
| Report Abuse |
|
|
|
| 30 Jan 2017 10:09 AM |
thanks
how would you make this a waitforchild? im not very experienced on it in addresses |
|
|
| Report Abuse |
|
|