Attempt to compare Boolean and Number

This might be a basic issue, which I’m shameful about.

This is a part of the entire script.

ClickDetector1.MouseClick:Connect(function(Player)

	if Crystal1Harvested == 0 then
		Percentage = math.random(0,100)
		print(Percentage)
		if 0 < Percentage < Blue then
			-- BLUE
			Crystal1.Material = "Neon"
			Crystal1.Color = Color3.fromRGB(0,85,255)
			Crystal1.PointLight.Color = Color3.fromRGB(0,85,255)
			game.BadgeService:AwardBadge(Player.UserId,2124659104)
			print(Player.Username.."has harvested the Blue Crystal!")
			Crystal1Harvested = 1
			wait(1)
			Crystal1.Transparency = 1
			Crystal1.ClickDetector:Destroy()
		elseif Blue <= Percentage <= Blue + Green then
-- JUST A SMALL PART OF THE SCRIPT

if 0 < Percentage < Blue then occurs the error.

You can’t type if statements like that, you need to compare them separately using and keyword:

if 0 < Percentage and Percentage < Blue then

Same goes for that elseif statement down below:

elseif Blue <= Percentage and Percentage <= (Blue + Green) then
3 Likes

Thank you so much, this is kind of an off-topic question but, is game.BadgeService:AwardBadge supposed to work in Studio’s Test Mode?

Yeah, it should work in studio without any problems.