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

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

Asked by
zValerian 108
5 years ago

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

Log in to vote
0
Answered by
Alphexus 498 Moderation Voter
5 years ago

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.

Ad
Log in to vote
0
Answered by 5 years ago
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

Answer this question