In my game, when the player clicks on an ImageButton, the game asks the player to purchase a gamepass. However, it says that it’s a product when it really is a gamepass, and I do not know why this happens.
The script is a bit long. Click here to see it.
This is the script inside of the ImageButton:
local market = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local userid = player.UserId
local passid = 7976960
local jumpScript = game.Workspace.DoupleJumpPass
local nice = game.Workspace.Nice
local debounce = false
local TweenService = game:GetService("TweenService")
local part = script.Parent.Parent.OwnText
local thanks = script.Parent.Parent.ThanksText
local tweenInfo = TweenInfo.new(
.8, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
4 -- DelayTime
)
local tween = TweenService:Create(part, tweenInfo, {TextTransparency = 1})
local tween2 = TweenService:Create(part, tweenInfo, {TextStrokeTransparency = 1})
local tween3 = TweenService:Create(part, tweenInfo, {TextTransparency = 1})
script.Parent.MouseButton1Click:Connect(function()
local ownpass = market:UserOwnsGamePassAsync(userid, passid)
if ownpass == true then
if not debounce then
debounce = true
print("Player owns pass.")
part.Visible = true
tween:Play()
tween2:Play()
wait(5)
part.Visible = false
wait(.1)
part.TextTransparency = 0
part.TextStrokeTransparency = .5
debounce = false
end
else
market:PromptGamePassPurchase(player, passid)
market.PromptGamePassPurchaseFinished:Connect(function(player, purchasePassID, purchaseSuccess)
if purchaseSuccess == true and purchasePassID == passid then
local playerScript = jumpScript.DoubleJump:Clone()
playerScript.Parent = player.Backpack
nice:Play()
print("Thank you for purchasing!")
thanks.Visible = true
tween3:Play()
wait(5)
thanks.Visible = false
end
end)
print("Wanna buy some stuff?")
end
end)
-
What do you want to achieve? I want the player to be able to purchase a gamepass (not product) when they click an image.
-
What is the issue? It shows “product” instead of “gamepass” for some reason.
-
What solutions have you tried so far? I tried looking for similar topics, but I had found no results giving me my answer.
Notice how it says product? I swear it’s a gamepass.
Nothing appears to be wrong with the script, and the only thing that isn’t working as intended is this gamepass and product swap. Any help is greatly appreciated.