#Gamepasses not working

1 messages · Page 1 of 1 (latest)

hollow fulcrum
#

So i made the script for the gamepasses, and for some reason only one of them gamepasses emits the pop up to buy it, while the other doesnt (I published the game and tried with an account that doesnt have it). They have the same code and everything i checked everything idk whats going on

hoary stream
hollow fulcrum
hoary stream
hollow fulcrum
#

one sec

#

they are in one script

#

the speedcoil one works but the gravity one doesnt

#

i get them when im testing in studio since i own them, but the gravity coil doesnt show the pop up when trying in another account

hoary stream
#

I don’t really remind how gp prompts works but I think you do not need a remote

#

Like just put them a LocalScript directly in the button

hollow fulcrum
#

this is the main script in serverscript

candid cosmosBOT
#

studio** You are now Level 1! **studio

hollow fulcrum
#

one sec

#

this is the one in the button

hoary stream
hollow fulcrum
#

no it should work since i have the exact same code in the speedcoilbutton

#

and it does work

#

since i get it when im testing in studio

#

the main problem here is that when live testing with a accoutn that doent own the gamepass, the pop up to buy it doesnt show for the gravitycoil

hoary stream
#

I would put the code to display the prompt directly inside of the localscript in the button, and if the users buy it, fire the remote event

#

And you handle the items giving within the server script with the remote event

hollow fulcrum
hoary stream
hollow fulcrum
#

yeah

#

local RemoteEvent = ReplicatedStorage:WaitForChild("RequestCoil")

#

yeah this line

hoary stream
#

MarketplaceService:PromptGamePassPurchase(player, info.ID)

#

This the thing to buy the gamepass, put it in localscript

hollow fulcrum
#

do i delete it from the main script?

#

like this u mean right

hoary stream
#

And you put the remote event below

hollow fulcrum
#

oh

#

like this?

hoary stream
# hollow fulcrum

function(player) and local MarketplaceService = game:GetService("MarketplaceService")

hollow fulcrum
#

i made this directly in the button

candid cosmosBOT
#

studio** You are now Level 2! **studio

hollow fulcrum
#

and this in serverscript

#

same problem as before

#

speedcoil is working while gravity isnt

quiet moth
#

Brother your not even processing the recipt

hollow fulcrum
hoary stream
#

In server script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MarketplaceService = game:GetService("MarketplaceService")

local event = ReplicatedStorage:WaitForChild("RequestCoil")

local gamePasses = {
    GravityCoilButton = {
        ID = 1203607668,
        ToolName = "GravityCoil",
    },
    SpeedCoilButton = {
        ID = 1201245284,
        ToolName = "SpeedCoil",
    }
}

event.OnServerEvent:Connect(function(player, buttonName)
    local info = gamePasses[buttonName]
    if not info then
        warn("Invalid button name sent:", buttonName)
        return
    end

    print("Button Clicked:", buttonName, "by", player.Name)

    local success, result = pcall(function()
        return MarketplaceService:UserOwnsGamePassAsync(player.UserId, info.ID)
    end)

    print("Ownership check - Success:", success, "Result:", result)

    if not success then
        warn("Failed to check GamePass ownership:", result)
        return
    end

    local ownsPass = result

    if ownsPass then
        local tool = ReplicatedStorage:FindFirstChild(info.ToolName)
        if tool then
            local clone = tool:Clone()
            clone.Parent = player:FindFirstChild("Backpack")
            print("Gave", info.ToolName, "to", player.Name)
        else
            warn("Tool not found in ReplicatedStorage:", info.ToolName)
        end
    else
        MarketplaceService:PromptGamePassPurchase(player, info.ID)
    end
end)
#

This LocalScript in each button and modify the FireServer line to put the other tool between strings

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("RequestCoil")

script.Parent.MouseButton1Click:Connect(function()
    event:FireServer("GravityCoilButton")
end)
#

Make sure both of your tools are in ReplicatedStorage and with the same exact name and as Tool, not model or part

#

@hollow fulcrum

hollow fulcrum
#

do you know why its returning that i dont own the gravutycoil's gamepass in studio