So I’m trying to make a button that prompts you when you click it.
This is the script for the button
local mps = game:GetService("MarketplaceService")
local gamepass_id = 9141220
script.Parent.MouseButtonClick:connect(function(
local player = game.Players.LocalPlayer
mps:PromptGamePassPurchase(player, gamepass_id)
end)
mps.PromptGamePassPurchaseFinished:connect(function(player, id, purchased)
if id == gamepass_id and purchased then
game.ReplicatedStorage.Give.Fireserver()
end
end)
This is the script in server script storage
local mps = game:GetService("MarketplaceService")
local gamepass_id = 9141220
game.Players.PlayerAdded:Connect(function(player)
if mps:UserOwnsGamePassAsync(player.UserId. gamepass_id) then
game.ServerStorage.Sniper3:Clone().Parent = player:WaitForChild("Backpack")
game.ServerStorage.Sniper3:Clone().Parent = player:WaitForChild("StarterGear")
end
end)
game.ReplicatedStorage.Give.OnServerEvent:Connect(function(player)
game.ServerStorage.Sniper3:Clone().Parent = player:WaitForChild("Backpack")
game.ServerStorage.Sniper3:Clone().Parent = player:WaitForChild("StarterGear")
end)