Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why are these two values unequal when I made them the same thing?

Why does it keep printing the false? I made the text the humanoid's health but trust me, it keeps saying it's false. (Only part of the script)

wait(0.1) -- Put this in so the humanoid can load in.
local textt = script.Parent.Parent:WaitForChild("ea")
local plr = game.Players.LocalPlayer.Name -- This is the player
local hum = game.Workspace:FindFirstChild(plr).Humanoid -- This is the humanoid
while wait(1) do -- This is to loop (Obviously)
	textt.Text = hum.Health -- You can see I made the humanoid health same to the text.
	if hum.Health == textt.Text then -- This is to see if the humanoid(players) health is equal to the text or not
	print(textt.Text .. hum.Health) -- If it is, it prints this, which it is NOT doing.
	else print('False? Text: '..textt.Text..' Health: '..hum.Health) -- It prints this
	end
end

1 answer

✓ Accepted answer

That’s because the Text is a String and your Health is a Number, So do this instead

if hum.Health == tonumber(textt.Text) then

2 comments

0

Thank you kind stranger.

0

Your welcome and go to the more active discord group of scriptinghelpers since there are always people there

This discussion is preserved as it was. New answers, comments, and votes are closed.