Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

--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

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.