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

Gamepass script is not working/FireServer from the Server?

Asked by 5 years ago

I made a gamepass which a user can buy when he/she clicks on an imagebutton, here is the code in a local script in the imagebutton.

local id = 6979186

script.Parent.MouseButton1Click:Connect(function()
    game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,id)
end)

and here is the code in a script in ServerScriptService

local id = 6979186
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
    if purchased and id == ido then
        print("Paid")
    game.ReplicatedStorage.GiveLongSword:FireServer()
    end
end)

I think the script isn't sensing when the player buys the gamepass because when I click on the imagebutton the "print("Paid")" isn't in the output. Also since the server would be trying to fire another server, do I have change it so it fires a client instead?

Answer this question