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

Does anyone know how to make gamepasses prompt you when you press on a button?

Asked by 4 years ago
Edited 4 years ago

So, this is the 6th time i have re-posted this and nobody has answered. I tried creating a script where you press on these buttons they prompt you.

It does not prompt me when i step on it. The same with a local server

Here's the script:

local MarketPlaceService = game:GetService("MarketplaceService")
    local Players = game:GetService("Players")

    local PromptSpeed = game.Workspace:WaitForChild("PromptSpeed")
    local PromptBox = game.Workspace:WaitForChild("PromptPart")
    local PromptPower = game.Workspace:WaitForChild("PromptJump")
    local PromptVip = game.Workspace:WaitForChild("PromptVIP")

    local function OnPromptPurchase(player, gamepassId)

        local HasPass = false

        local Humanoid = player.Parent:FindFirstChildOfClass("Humanoid")

        if (Humanoid) then
            player = Players.LocalPlayer

        HasPass = MarketPlaceService:UserOwnsGamePassAsync(player.UserId, gamepassId)  
        end

        if HasPass then
        print("Player has the gamepass!")
    end
        if not HasPass then
            PromptSpeed.Touched:Connect(function(player)
                MarketPlaceService:PromptGamePassPurchase(player, 8638546)
                end)

                    if not HasPass then
                        PromptBox.Touched:Connect(function(player)
                            MarketPlaceService:PromptGamePassPurchase(player, 8582273)
                    end)
                        if not HasPass then
                            PromptPower.Touched:Connect(function(player)
                                MarketPlaceService:PromptGamePassPurchase(player, 8796152)
                        end)
                            if not HasPass then
                                PromptVip.Touched:Connect(function(player)
                                    MarketPlaceService:PromptGamePassPurchase(player, 8757181)
                            end)
                        end
                        end
                   end
                        end
                        end

0
Uh what is the issues? Block_manvn 395 — 4y
0
It does not prompt me when i step on it. I have tried on a Local Server Too maxpax2009 340 — 4y
0
It’s because your script is so horribly formatted it turns anyone who dares to try to understand the absolute chaos you call indentation away. I would be glad to assist you, but I ask that you clean up your code; this is a good practice anyway!! Check my bio. Ziffixture 6913 — 4y
0
@Feahren - Thanks for the encouragement. I will soon give up on scripting. I have gotten no encouragement through my scripting experience, even how hard i try it always ends up in someone criticizing me. Thanks for the response... maxpax2009 340 — 4y
View all comments (2 more)
0
@Feahren - I would like to see how you would do it. I'm an absolute beginner, with almost no experience at all. At-least you could of tried to say it in a pleasant way instead of; "YOUR SCRIPT IS SO HORRIBLE ITS SO MUCH CHAOS." No wonder I'm soon going to give up on this. maxpax2009 340 — 4y
0
How would i write my script neatly? what would you advise me get better at? Get a lower temper, write better? maxpax2009 340 — 4y

Answer this question