Script works in studio but not in the real game? It's probably simple, but beyond me.
So I am messing with a hunger/thirst system thing. For example if you click with the water bottle it's supposed to become empty.
There's this script which it connects with, that gives the player the values of the things like "Hunger" "Thirst" "Total Hunger" and so on. For some reason the water bottle script doesnt seem to be connecting with the other script. Here is the bottle script.
01 | bottle = script.Parent; |
04 | function DrinkWater(player) |
05 | player.Thirst.Value = player.Thirst.Value + s.thirstQuenching; |
06 | if player.Thirst.Value > player.TotalThirst.Value then |
07 | player.Thirst.Value = player.TotalThirst.Value; |
09 | bottle.Name = "Bottle" ; |
12 | bottle.Equipped:connect( function (m) |
13 | local char = bottle.Parent; |
14 | local player = game.Players:GetPlayerFromCharacter(char); |
15 | m.Button 1 Down:connect( function () |
16 | local target = m.Target; |
17 | if bottle.Name = = "Bottle of Water" then |
21 | if target.Name:lower() = = "well water" then |
22 | bottle.Name = "Bottle of Water" ; |
Here is the other script
03 | s = require(workspace.Settings); |
07 | game.Players.PlayerAdded:connect( function (p) |
08 | local th = Instance.new( "IntValue" , p); |
09 | th.Name = "TotalHunger" ; |
10 | th.Value = s.totalHunger; |
11 | local hb = Instance.new( "IntValue" , p); |
12 | hb.Name = "HungerBurnup" ; |
13 | hb.Value = s.hungerBurnup; |
14 | local hunger = Instance.new( "IntValue" , p); |
15 | hunger.Name = "Hunger" ; |
16 | hunger.Value = s.totalHunger; |
17 | local tt = Instance.new( "IntValue" , p); |
18 | tt.Name = "TotalThirst" ; |
19 | tt.Value = s.totalThirst; |
20 | local dr = Instance.new( "IntValue" , p); |
21 | dr.Name = "DehydrationRate" ; |
22 | dr.Value = s.dehydrationRate; |
23 | local thirst = Instance.new( "IntValue" , p); |
24 | thirst.Name = "Thirst" ; |
25 | thirst.Value = s.totalThirst; |
26 | local killRateLow = Instance.new( "IntValue" , p); |
27 | killRateLow.Name = "KillRateLow" ; |
28 | killRateLow.Value = s.killRate.low; |
29 | local killRateHigh = Instance.new( "IntValue" , p); |
30 | killRateHigh.Name = "KillRateHigh" ; |
31 | killRateHigh.Value = s.killRate.high; |
32 | p.PlayerGui:WaitForChild( "Main" ); |
33 | p.PlayerGui.Main.Updater.Disabled = false ; |
I tried copying and pasting the values script into a localscript in StartPlayerScripts. It didn't work. I'm sure the reason is simple, but I can't seem to figure it out. Any help is appreciated.