Why doesn't this work?

I am making a heat system for my antarctica game, and made a script which slowly kills player, but it doesn’t work, anyone knows why?

local humanoid = script.Parent:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
local value = player:WaitForChild("Heated")
while true do
	if value.Value == true then
		humanoid.Health = humanoid.Health - 1
	else
		humanoid.Health = humanoid.Health + 1
	end
	task.wait(1)
end

It’s most likely due to the fact that the Heated value is set to false and or the Heated object was not found in the Player instance.

1 Like

Try adding prints to debug what’s happening. For example:

while true do
print(value.Value)
1 Like

It’s working after switching the “heated” value to “not heated”. Thank you so much for help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.