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

how do i fix this broken gamepass script that checks if I own it or not?

Supposed to check if you own a gamepass and if you do, you get teleported somwhere, if you don't, it prompts you to buy it.

Currently doesn't work and it shows the wrong gamepass when i'm asked to buy

script.Parent.ClickDetector.MouseClick:connect(function(player) 
		

   local hasPass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId, 3369333)

if hasPass ~= true then

game:GetService("MarketplaceService"):PromptPurchase(player, 3369333)
end

if hasPass == true then

player.Humanoid.Torso.CFrame = workspace.TPHERE.CFrame

print("XD")
		end
end)

2 answers

Change the numbers in line 4 and 8 to the gamepass id. And line 13 should be player.Character.HumanoidRootPart.Position = workspace.TPHERE.Position

That’s it. Should work. If anything wrong feel free to reply.

script.Parent.ClickDetector.MouseClick:connect(function(player) 


   local hasPass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId, 3369333)

if hasPass ~= true then

game:GetService("MarketplaceService"):PromptPurchase(player, 3369333)
else

player.Character.HumanoidRootPart.CFrame = CFrame.new(workspace.TPHERE.Position)

print("XD")
        end
end)

checks if they got the gamepass, if they do then they will get teleported to TPHERE position, else they will get prompted to buy it

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