local id = 18411129
parent = script.Parent
player = game.Players.LocalPlayer
AnotherBrick = game.Workspace.winners
parent.Touched:connect(function(part) -- 3
	if part.Parent.Humanoid then -- *
		if part.Parent.Humanoid.Health > 0 then -- 4
			if game:GetService("GamePassService"):PlayerHasPass(player, id) then 
				part.Parent:MoveTo(AnotherBrick.Position) -- 5
				print("success!")
			else
				player:PromptGamePassPurchase(player, id)
			end
		end
	end
end)

2 comments

0

Why are you using the Legacy version of checking if a player owns a gamepass? UserOwnsGamepassAsync it the current method, and should be used instead of PlayerHasPass. https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/UserOwnsGamePassAsync

0

That means you should use MarketplaceService instead of GamePassService