|
| 29 Aug 2016 10:34 PM |
Here's how it is, so I have a part in workspace with a surfacegui inside it, and a text button inside it. What I want, is so when I click the text button, the "hunger" goes to 100. I have all it all right, it's just the scripts:
Inside the hunger bar: --If hunger = 0 this kills the player.-- while wait() do if script.Parent.Value.Value == 0 then game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").Health = 0 end end
Inside the hunger bar: --This haves it so negative signs aren't shown and to make sure if it does happen, the player dies.-- while wait() do if script.Parent.Value.Value <= 0 then script.Parent.Value.Value = 0 end end
Inside the hunger bar: --This haves it so the hunger bar shows "Hunger:", then the value which is the hunger.(By the way the hunger value starts at 100 at the join of the game and the respawn of a player)-- while wait() do script.Parent.Text = ("Hunger:"..script.Parent.Value.Value) end
Inside PlayerGui: --This haves it so every ten seconds someone loses a "hunger" value.-- while true do wait(10) script.Parent.Hunger.TextLabel.Value.Value = script.Parent.Hunger.TextLabel.Value.Value - 1 end
Inside a text button, the text button is inside a surfacegui, and the surfacegui is inside a part: --I am TRYING to make it, so if a players "wood" is 5, then when they hit this they lose 5 wood and get their hunger to 100, it does not get their wood to 100, it gets their wood to stay that same. function gettingfed() if game.Workspace.WoodPart.SurfaceGui.TextLabel.Value.Value >= 5 then game.Players.LocalPlayer.PlayerGui.Hunger.TextLabel.Value.Value = 100 game.Workspace.WoodPart.SurfaceGui.TextLabel.Value.Value = game.Workspace.WoodPart.SurfaceGui.TextLabel.Value.Value - 5 else--(PLEASE IGNORE THE SPACING BETWEEN THE TWO LINES ABOVE, THE FORUM SIZING DOES THAT) end end
script.Parent.MouseButton1Click:connect(gettingfed)
--So, I do not know WHAT is wrong with these scripts, but it does not get the hunger to 100 when "fed". Everything else works, though. When I click the button to get fed, I don't lose wood, and I don't get "fed".
|
|
|
| Report Abuse |
|
|
| 29 Aug 2016 10:37 PM |
| By the way, there are no errors in the output. |
|
|
| Report Abuse |
|
|
| 30 Aug 2016 08:48 AM |
| What's the else in the end for ??? |
|
|
| Report Abuse |
|