Why is there an error in my script?

For some reason it says I’m trying to compare an instance with a number. But I’m sure the instance is a number value so I’m not sure what’s wrong.
Please help, and have a great day.
Error:
Players.SilentSuprion.PlayerGui.StatsGui.StaminaFrame.TextLabel.LocalScript:8: attempt to compare Instance <= number

Can you provide line 8 of your code?

Uhh dont you think you should send the script?

My bad I forgot sorry
Script:

while wait(0.1) do
	if Stamina <= 100 then --Line 8
		Max = true
	end
	
	if Max == false then
		wait(0.5)
		Stamina += 0.5
	end
end

Can you also provide what “Stamina” is declared as?

If Stamina is a Number value, then you need to use Stamina.Value

1 Like

.Value works but it doesn’t add this

if Max == false then
	wait(0.5)
	Stamina += 0.5

I know it’s a different topic, but it’s probably a simple mistake.

You set max to true but never set it to false. What you are doing is a little confusing, but I think this is what you want.
while wait(0.1) do
if Stamina.Value<100 then Stamina.Value += 0.5 end
end

1 Like