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.

1local id = 6979186
2 
3script.Parent.MouseButton1Click:Connect(function()
4    game:GetService("MarketplaceService"):PromptGamePassPurchase(game.Players.LocalPlayer,id)
5end)

and here is the code in a script in ServerScriptService

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

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