Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i check a boolvalue in a player?

Asked by 2 years ago

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

Log in to vote
0
Answered by 2 years ago

When answering, if your answer does not fully solve the question, it should be written as a comment to the question instead of as an answer.

in line 7 you must delete end.

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. JesseSong 3916 — 2y
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. JesseSong 3916 — 2y
0
hey this person accepted my previous answer so why you delete a useful ?ner lehoaiquoc248 23 — 2y
Ad

Answer this question