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

why will this script only work in studio but in the real game it says that an object is not there?

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

0

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.

1 answer

Can i see the script that gives the player the ThirstVal?

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