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

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

Asked by
zValerian 108
6 years ago

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.

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. yellp1 193 — 6y

1 answer

Log in to vote
-1
Answered by 6 years ago

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

Ad

Answer this question