Hello, I am developing a game and there is a wall which you can only pass if you have bought a gamepass. The problem is that i tested it out with a friend but the wall was not there even tho he didnt purchase the game pass.
I've put a local script into the wall and it's
script.Parent.Touched:Connect(function(hit)
game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer, 18801304)
end)
I've also put a script into serverscriptservice which does :
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local conveyorGamepassID = 18801304
game.Players.PlayerAdded:Connect(function(player)
local success, message = pcall(function()
hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, conveyorGamepassID)
end)
if hasPass then
print("player has the gamepass")
game.Workspace.MainBuild.MainConveyor.ConveyorBorder.CanCollide = false
end
end)
local function onPromptGamePassPurchaseFinished(player, purchasedPassID, purchaseSuccess)
if purchaseSuccess == true and purchasedPassID == conveyorGamepassID then
print(player.Name .. " purchased the game pass!")
game.Workspace.MainBuild.MainConveyor.ConveyorBorder.CanCollide = false
end
end
MarketplaceService.PromptGamePassPurchaseFinished:Connect(onPromptGamePassPurchaseFinished)
Could anyone please help?

3 comments
Nozazxe could you please help me to fix that? I'm new to scripting so i dont know that much
Alright, here it is
@SubNinjaPav Done!