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

How do i make multiple block prompt me when i step on bricks? [Argument 2 Missing or Nil!?]

Asked by 4 years ago
Edited 4 years ago

GOAL: I'm trying to create a script that when i touch these bricks, they prompt me.

ERROR: They are not prompting me?

Do you need a type of Service? Is it just me that is bad at scripting and formatting?

You will find out here:

local MarketPlaceService = game:GetService("MarketplaceService")

local function PromptPurchase(Player, GamepassId)

    local Player = game.Players.LocalPlayer
    local HasPass = false

    local sucess, errormessage = pcall(function()
        HasPass = MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId)
end)

    if HasPass then
        print("Player has gamepass")
        return HasPass
        end
        end

        game.Workspace.PromptPart.Touched:Connect(function(Player)
            MarketPlaceService:PromptGamePassPurchase(PromptPurchase(Player, 8582273))
            end)

        game.Workspace.PromptSpeed.Touched:Connect(function(Player)
            MarketPlaceService:PromptGamePassPurchase(PromptPurchase(Player, 8638546))
            end)

            game.Workspace.PromptVIP.Touched:Connect(function(Player)
                MarketPlaceService:PromptGamePassPurchase(PromptPurchase(Player, 8757181))
                end)

            game.Workspace.PromptJump.Touched:Connect(function(Player)
                MarketPlaceService:PromptGamePassPurchase(PromptPurchase(Player, 8796152))
        end)

Answer this question