Output returning that I forgot an "end" despite there being enough

“Expected ‘end’ (to close ‘function’ at line 6), got ‘else’; did you forget to close ‘then’ at line 7?”

local badge = game:GetService("BadgeService")
local GrasslandsID = 189799329 -- Some badge I own

local Drylands = game.Workspace.Drylands

game.Players.PlayerAdded:connect(function(Player)
	if badge:UserHasBadge(Player.UserId, GrasslandsID) then
		print("Placeholder!")
	end

	else
		for i, child in ipairs(Drylands:GetChildren()) do -- Darkens model's parts
			if child.Name == "Part" then
				child.Color = Color3:fromRGB(13,13,13)
				child.Material = "SmoothPlastic"
			end	
		end

		for i, child in ipairs(Drylands:GetChildren()) do -- Deletes portal
			if child.Name == "Portal" or child.Name == "BadgeDoor" then
				child:destroy()
			end
		end
	end
end)



Your end there confuses it because the else is supposed to have the end.

1 Like

Drop the end from your first if-statement

Thanks! :smiley:


1 Like