I just want the button (textbutton) to check if you own the gamepass, if you do it gives you the perks, if you dont only then it prompts to purchase the gamepass. I tried fixing it on my own and know it must not be that hard but it didnt work.
local player = script.Parent.Parent.Parent.Parent local button = script.Parent local MarketServicePlace = game:GetService("MarketplaceService") local id = 18020349 script.Parent.MouseButton1Click:Connect(function() game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id) game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased) if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,id) == true then player.Character.Humanoid.HeadScale.Value = 0.35 player.Character.Humanoid.BodyDepthScale.Value = 0.35 player.Character.Humanoid.BodyWidthScale.Value = 0.35 player.Character.Humanoid.BodyHeightScale.Value = 0.35 player.Character.Humanoid.WalkSpeed = 30 player.Character.Humanoid.JumpPower = 500 end end) end)
(I am not sure if this works, but I hope it does, I changed the if statement to the parameter of Purchased and made it if Purchased == true then or something)
I think this is what you wanted, you need to buy the gamepass and click again to make it work, if you want something better than contact me, I might help, this script is a complete rush
local player = game:GetService("Players").LocalPlayer local button = script.Parent local MarketServicePlace = game:GetService("MarketplaceService") local id = 18020349 script.Parent.MouseButton1Click:Connect(function() if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) == true then -- do thing you want else game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id) end) end)
To check if someone has the gamepass, you do the following
local MarketPlaceService = game:GetService("MarketPlaceService ") local PlayerBoughtThisGamePass = MarketPlaceService.UserOwnsGamePassAsync(Userid, GamePassiD) if PlayerBoughtThisGamePass then print("Player Has Bought This GamePass") else --prompt the game pass, idk how to do that end