Check for gamepass not working

Hey, I am making a Headless gamepass and when someone runs the command “!headless” and they don’t own it, they recieve the headless anyways.

--[ SERVICES ]--

local MarketPlaceService = game:GetService("MarketplaceService")

--[ LOCALS ]--

local Command = "!headless"
local Gamepass = 116623087

--[ FUNCTIONS ]--

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(chr)
		player.Chatted:Connect(function(msg)
			
			local UserId = player.UserId
			local PlayerBoughtThisGamepass = MarketPlaceService:UserOwnsGamePassAsync(UserId, Gamepass)
			local Humanoid = chr:WaitForChild("Humanoid")
			local Desc = Humanoid:GetAppliedDescription()
			Desc.Head = 134082579
			
			if PlayerBoughtThisGamepass then
				if msg:sub(1, Command:len()):lower() == Command:lower() then
					Humanoid:ApplyDescription(Desc)
				end
			else
				print("does not own gamepass")
			end
		end)
	end)
end)
1 Like

Is there any errors? adasdj

No errors, nothing comes up in the console.

1 Like

Probably a server script, but I’m just gonna ask. Is it a server script?

It is a server script, yes. dsfds

I don’t know much about Marketplace Service, but are you sure that the client shouldn’t be involved?

I got rid of the if statement that checks if the player owns the gamepass, and it worked, so something may be wrong in the if statement. Can you send a video (or description) of exactly what you did?

It was just me being stupid, I had the same script in workspace without the gamepass check so that was running when the command was said!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.