I have a different code that gives the player the stuff do I have to put it in this? This is a gamepass shop gui. When I click it,it says gamepass currently not available how can I make available?

local productId = 4937288
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function() 
script.Parent:FindFirstChild("SelectionPopSound"):Play()
game:GetService("MarketplaceService"):PromptPurchase(player, productId)
end)

Code that gives the stuff to player

local player = script.Parent.Parent.Parent.Parent.Parent
 local Player = game.Players.LocalPlayer
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.userId,4937288 ) then
	script.Parent.Visible = true
    script.Parent.MouseButton1Click:connect(function()
 if Player.Character.Humanoid.WalkSpeed == 16 then Player.Character.Humanoid.WalkSpeed = 50
	script.Parent.Text = "Click for normal speed!"
else
	
	   if Player.Character.Humanoid.WalkSpeed == 50 then Player.Character.Humanoid.WalkSpeed = 16
		script.Parent.Text = "Click Here to have 50+ speed "
        end
    end
end)
end

1 comment