I'm making a zombie game with food and thirst systems. What I'm doing now is making so that the value of one's hunger or thirst is equal to the text of the GUI.
local plr = game.Players.LocalPlayer
while true do
local systems = plr.Character:FindFirstChild("FoodAndThirstSystems")
local thirstval = systems:FindFirstChild("ThirstVal")
script.Parent.Text = "Hunger: " ..(tostring(thirstval.Value))
if thirstval.Value < 10 then
script.Parent.BackgroundColor3 = Color3.new(0.666667, 0, 0)
else
script.Parent.BackgroundColor3 = Color3.new(0.333333, 1, 1)
end
wait(.1)
end
I have the part where the text of the GUI is equal to the Value of one's thirst value.
But in line 5, it has an error that always says " Attempt to index nil with 'FindFirstChild' " I've tried doing "systems.ThirstVal" but it still shows up with: Attepmt to index nil with 'ThirstVal'.
Please tell me what to do. Thanks!

1 comment
what did you do? you should post how to fix it in the answer sections whether you or someone else found it