In studio, this script works just fine and increases the thirst bar up..
script.Parent.Touched:connect(function(hit)
print("touched")
local Plr = game.Players:GetPlayerFromCharacter(hit.Parent)
wait()
local ThirstVal = Plr.ThirstVal
ThirstVal.Value = ThirstVal.Value + 10
if ThirstVal.Value > 100 then
ThirstVal.Value = 100
end
end)
It gets triggered when a player steps on an object.
In the real game however, it doesn't work and this error code pops up:
https://gyazo.com/e11d1dafc81587c297712883e307284c
why does this only happen in the real game and not studio? Anything helps.

1 comment
have you tried doing :FindFIrstChild("ThirstVal") or :WaitForChild("ThirstVal")? if so, open up explorer while in game and open up your player. If the player has no value in it labeled "ThirstVal" in it, then maybe check the script that gives you the value. There might be an error in it.