Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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!

2 comments

0

Still dose not work.

0

Have you got Studio API on? Sometimes this contributes to the problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.