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

Issue with gamepass door firing a remote event. Any solutions?

Asked by
xp5u 25
3 years ago
Edited 3 years ago
--In a seperate server script, you will fire the remote event when the player buys the VIP
local MPS = game:GetService("MarketplaceService")
local ID = 8272545
local remote = game.ReplicatedStorage.VipDoorFire --name that properly
local button = script.Parent --name that properly


button.Touched:Connect(function(player) --the part that hit
    MPS:PromptGamePassPurchase(player, ID)

    MPS.PromptGamePassPurchaseFinished:Connect(function(player, gamepassId, purchased)
        if gamepassId == ID and purchased then
            remote:FireClient(player)
        end
    end)
end)

It is a script inside the gamepass door

Error here: MarketplaceService:PromptGamePassPurchase() player should be of type Player, but is of type Part - Server - Script:9

1 answer

Log in to vote
0
Answered by 3 years ago
local MPS = game:GetService("MarketplaceService")
local ID = 8272545
local remote = game.ReplicatedStorage.VipDoorFire
local button = script.Parent 


button.Touched:Connect(function(hit) -- as it said, this is the part that hit not the player
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
    MPS:PromptGamePassPurchase(player, ID)

    MPS.PromptGamePassPurchaseFinished:Connect(function(player, gamepassId, purchased)
        if gamepassId == ID and purchased then
            remote:FireClient(player)
        end
    end)
end
end)

Ad

Answer this question