#Eating script stops working when I check if the hunger value is equal to or under 80
1 messages · Page 1 of 1 (latest)
server script
and the Activated event doesn't have player as parameter
script.parent is the tool
No but a better practice is like this: local tool = script.Parent
you should make a variable for that instead of type script.Parent many times
wait im stupid
i was looking at the wrong script 😭
it IS a server script
@atomic light
bruh
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local HungerBar = PlayerGui:WaitForChild("HungerBar")
local currentNum = HungerBar:WaitForChild("CurrentValue")
local character = player.Character or player.CharacterAdded:Wait()
if not character then return end
local Tool = script.Parent
Tool.Activated:Connect(function()
if currentNum.Value <= 80 then
currentNum.Value = currentNum.Value + 20
Tool:Destroy()
end
end)
try to use this script from local script
ty it works
np