Howdy DevForum members! I am trying to make this simple script so that when this IntValue reaches 0 the player gets kicked. This is what I have currently.
if script.Parent.HungerAmount.Value == 0 then
script.Parent.Parent.Parent.Parent.Parent:Kick("Your pet died!")
end
I am not sure if this is the correct way because I am not much of a scripter.
You need to check when it changes, right now you’re just checking once if it equals 0, then never again.
script.Parent.HungerAmount.Changed:Connect(function()
if script.Parent.HungerAmount.Value == 0 then
script.Parent.Parent.Parent.Parent.Parent:Kick("Your pet died!")
end
end)