Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do i check a boolvalue in a player?

i'm trying to check a boolean value in the player to see if they have food, and stop the script if they do, or give them food and then set the value to true, but i dont know how to work this out

--this is the value for if you have food or not
local hasIngredient = game.Players:FindFirstChild("hasIngredient")

--this is inside a function
if hasIngredient.Value = true then --this just says expected identifier
	print("you already have one") --just for testing
	end
       else
            if db and player then
		db = false
		foodNumber.Value = foodNumber.Value - 1
		foodLeft.Text = tostring(foodNumber.Value)
	           local inv = player.Backpack 
	           local tool = game.ServerStorage["Tomato"]
	           tool:Clone().Parent = inv
		   hasIngredient.Value = true --i set the has food value to true afterwards
	       wait(2)
		   db = true
		end

1 answer

in line 7 you must delete end.

3 comments

0

If you're not going to post an explanation then use the comment instead. Even if it's wrong, at least post something with some code, that should at least answer or assist the poster.

0

This isn't even an answer. Make sure you write whatever you need to write in the comments, if they're not an explanation. I'm gonna start deleting answers like this if you don't at least assist the poster.

0

hey this person accepted my previous answer so why you delete a useful ?ner

This discussion is preserved as it was. New answers, comments, and votes are closed.