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

Im try to make a boost pad that needs a gamepass. I get no errors when I run this? Please help.

Asked by 6 years ago
Edited 6 years ago

Basically, I'm trying to make a jump boost and if you have that game pass it will boost you then turn you back. Also if you don't have the game pass it will prompt you to buy it and not change your speed. I get no errors but It still does not work. Here is the code:

script.Parent.Touched:connect(function(player)
    -- make sure the part still exists
    if not script.Parent then return end

    -- make sure it's a humanoid
    local humanoid = script.Parent:FindFirstChild("Humanoid")
    if not humanoid  then return end

if game:GetService("GamePassService"):PlayerHasPass(player, 4907357) then 
    humanoid.WalkSpeed = 16 * 5
wait(.3)
       humanoid.WalkSpeed = 16
else
    game:GetService("MarketplaceService"):PromptPurchase(player, 4907357)
end
end)

2 answers

Log in to vote
0
Answered by 6 years ago

I think you are using the old gamepass method. Read this: https://devforum.roblox.com/t/live-changes-to-game-passes/116918

Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

It seems like you're using the old "PlayerHasPass" method along with "PromptPurchase", Roblox recently changed this hence why it doesn't work. Here is a fix:

script.Parent.Touched:connect(function(player)
    -- make sure the part still exists
    if not script.Parent then return end

    -- make sure it's a humanoid
    local humanoid = script.Parent:FindFirstChild("Humanoid")
    if not humanoid  then return end

if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 4907357) then 
    humanoid.WalkSpeed = 16 * 5
wait(.3)
       humanoid.WalkSpeed = 16
else
    game:GetService("MarketplaceService"):PromptGamePassPurchase(player, 4907357)
end
end)

You may also want to test it out with Studio API on and try purchasing in a test server to make sure it works.

Hope this helps and let me know if you get any errors!

0
Still dose not work. appleprogamer_59 29 — 6y
0
Have you got Studio API on? Sometimes this contributes to the problem. Z80_Performance 7 — 6y

Answer this question