This is script is supposed to make a THIRSTGUI go up when I touch ANY brick with the name water. However, it doesn't work. It has no errors in console. This is a LOCAL SCRIPT.

local block = "Water"
wait(1)
local debounce = false
local thirst = game.Players.LocalPlayer:WaitForChild("ThirstVal")
repeat wait() until  game.Players.LocalPlayer.Character
local character = game.Players.LocalPlayer.Character

game.Players.LocalPlayer.Character.HumanoidRootPart.Touched:connect(function(p)
    if p.Name == block then
        thirst.Value = thirst.Value + 10
        if thirst.Value > 100 then
            thirst.Value = 100
        end
   end
end)

5 comments

0

connect is deprecated, use Connect

0

still doesn't work

0

If this is located somewhere within Workspace then that might be your issue. Try moving it into StarterPlayer > StarterPlayerScripts.

0

You could also try print debugging

0

1 broken line of code = all the local script's code source will not work properly.