Why is there an orange line in every function I make?

Basically I’m getting this “bug” everytime i write a function:


Any help?
Btw it’s not my first time facing this.

maybe try to put “local” behind the function, something like this

local function Spawned()
   -- code
end
1 Like

still doing the same thing.
30 cs

or maybe try to hover your mouse on the lines to see what’s wrong

Are you sure that’s the entire script? I wrote it, and I don’t see any orange lines in there at all

This is what I used, it shouldn’t be too different:

local MarketplaceService = game:GetService("MarketplaceService")
local GamepassID = 0

function Spawned(player)
	local HasGamepass = false
	
	local success, message = pcall(function()
		HasGamepass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)
	end)	
	
	if not success then
		warn("Checking in if Player has gamepass: "..tostring(message))
		return
	end
	
	if HasGamepass == true then
		print("Has gamepass")
	end
end

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(Spawned)
end)