So I’m tryna make this red block for example if you enter inside the red block a gamepass popup should show up how do I do this can someone help me? Thank you.
Example
So I’m tryna make this red block for example if you enter inside the red block a gamepass popup should show up how do I do this can someone help me? Thank you.
Example
In a script inside the part
AreaPart.Touched:Connect(functiion(Plr)
game.ReplicatedStorage.RemoteEvent:FireClient(Plr,"ShowGamepass")
end)
in a script inside starterGui of the gui you want to toggle on and off
local gui = script.Parent
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(EventName)
if EventName -- "ShowGamepass" then
gui.Enabled = true
end
end)
Let me try that give me once second
But I’m talking about a certain gamepass like only a single gamepass to popup the ordinary gamepass gui by roblox.
Make it so that when you touch the part, a gamepass prompt pops up.
You could search up how to do that.
Yeah but how do I do that kind sir?
I’ve been searching I can’t find anything
Ok. I’ve got something to do right now, so I won’t be available at the moment. I’ll catch you in a while.
Here’s a script that might work. Put it in the red part
local Id = --Put your game pass id here--
local MPS = game:GetService("MarketplaceService")
script.Parent.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
local HumanoidRootPart = hit.Parent:FindFirstChild("HumanoidRootPart")
local Player = game.Players:FindFirstChild(hit.Parent.Name)
if Humanoid and HumanoidRootPart and Player then
MarketplaceService:PrompGamepassPurchase(Id, Player)
end
end)
To prompt the purchase of a gamepass, you can use MarketplaceService:PromptGamePassPurchase().
You can detect when a player touches the part and prompt the purchase of a specified gamepass by doing something such as shown in the example below.
local MarketplaceService = game:GetService("MarketplaceService")
local gamepassId = 1234567890 -- Change to your gamepass ID
local part = game.Workspace.Part -- Change to where the part is
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then -- Make sure it's a character who is touching the part
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
MarketplaceService:PromptGamePassPurchase(player,gamepassId)
end
end)
You may also want to check if the player already owns the gamepass before prompting it, and this can be done using MarketplaceService:UserOwnsGamePassAsync(). Note that the code above runs no matter if the player owns the gamepass or not.
I tried it I followed what it said on the script and still didnt work
Are there any errors? Those might be the problem
It worked but I bought the gamepass then I went into the area again it wanted me to purchase another one, how do I make the gamepass a one time purchase.
As stated in my previous post, you can check if the player owns the gamepass before prompting the purchase using MarketplaceService:UserOwnsGamePassAsync(). An example using the code I provided above can be seen below.
local MarketplaceService = game:GetService("MarketplaceService")
local gamepassId = 1234567890 -- Change to your gamepass ID
local part = game.Workspace.Part -- Change to where the part is
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChildOfClass("Humanoid") then -- Make sure it's a character who is touching the part
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not MarketplaceService:UserOwnsGamePassAsync(player.UserId,gamepassId) then
MarketplaceService:PromptGamePassPurchase(player,gamepassId)
end
end
end)
Okay I tried doing it in my main game but it doesent work there but if I do it in my testing game which barely has parts and stuff etc it works.
btw I’m talking about the whole thing not just the one time purchase issue