So i created a little part it is called orange just an orange sphere i have a Hunger GUI and i want it that when player touches it you will get say +20 hunger out of the 150 i got here is the hunger GUI script (WORKS) hunger = 150 local plr = game.Players.LocalPlayer while true do script.Parent.Text = ('%') .. hunger.. ('') wait(1) hunger = hunger - 1 if hunger == 0 then plr.Character.Humanoid.Health = 0 end end
then for the orange on touch event i found a model that actually worked and i was able to ontouch event make the models little part disapear using the code from the script that was provided , when i copy and paste it to mine double checked it for links it still wouldnt work
Code from the model i found : function Eat(hit) -- put this script in the cake
if (hit.Parent:findFirstChild("Humanoid") ~= nil) then script.Parent:Remove() end end end
script.Parent.Touched:connect(Eat)
and here is the output window error:
20:06:18.752 - MY FPS game was auto-saved 20:06:20.578 - Workspace.Part.Script:7: 'then' expected near 'hunger' 20:06:20.580 - name is not a valid member of IntValue
sorry if its confusing but to sum it up i have a part which when i walk over i want it to disapear and give my character +20 hunger which the hunger gui is already provided i have attempted multiple times and went on youtube and wiki for answers but my efforts were very hopeless :( thank you so much if you look into this :D I believe this is something to do with events

3 comments
Future reference: Highlight the code you're providing, then click the LUA icon symbol. This formats the code to easily understand it.
^ It's Lua.
What LUA do you mean here? http://acronyms.thefreedictionary.com/lua