Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Game pass that removes wall?

Asked by 3 years ago

I'm developing a game where you can go into a gui and buy a gamepass which removes a wall. The problem is that when i was in game i tested it out wiht a friend and even tho he hadn't purchased it he still couldnt see the wall and went right through it. For some reason what the gamepass does everyone has even tho they havent pruchased it. I put a local script inside the gui which is

local MPS = game:GetService("MarketplaceService")
local MainFrame = script.Parent.MainFrame
local conveyorGP = script.Parent.MainFrame.ConveyorFrame.BuyConveyor
local openShop = script.Parent.ShopButton
local player = game.Players.LocalPlayer
local conveyorID = 18801304

conveyorGP.MouseButton1Click:Connect(function()
    local success, message = pcall(function()
        hasPass = MPS:UserOwnsGamePassAsync(player.UserId, conveyorID)
    end)

    if hasPass then
        print("player has the gamepass")
    else    
        MPS:PromptGamePassPurchase(player, conveyorID)
    end
end)

openShop.MouseButton1Click:Connect(function()
    MainFrame.Visible = not MainFrame.Visible
end)

I've also put a script inside server script service which is the thing that makes it do something :

local MPS = game:GetService("MarketplaceService")
local MainFrame = script.Parent.MainFrame
local conveyorGP = script.Parent.MainFrame.ConveyorFrame.BuyConveyor
local openShop = script.Parent.ShopButton
local player = game.Players.LocalPlayer
local conveyorID = 18801304

conveyorGP.MouseButton1Click:Connect(function()
    local success, message = pcall(function()
        hasPass = MPS:UserOwnsGamePassAsync(player.UserId, conveyorID)
    end)

    if hasPass then
        print("player has the gamepass")
    else    
        MPS:PromptGamePassPurchase(player, conveyorID)
    end
end)

openShop.MouseButton1Click:Connect(function()
    MainFrame.Visible = not MainFrame.Visible
end)

Could anyone help me?, im new to scripting.

Answer this question