I have a V.I.P. door in a game and I want to make the purchase GUI if the person trying to go through the door if they do not have the game pass
I don’t know how to do that
(this is a local script in the starter GUI)
I have a V.I.P. door in a game and I want to make the purchase GUI if the person trying to go through the door if they do not have the game pass
I don’t know how to do that
(this is a local script in the starter GUI)
Try using the .Touched event of the door part to connect to a function, then inside of the function, do the if statement.
local MS = game:GetService("MarketplaceService")
local ID = 000000
if MS:UserOwnsGamePassAsync(ID) then
--stuff here
end
ok, where do I put that in the script
ServerScriptService Put it as a Script not local script
for example
local MS = game:GetService("MarketplaceService")
local ID = 000000
local VIP_DOOR = --DoorLocation
if MS:UserOwnsGamePassAsync(ID) then
VIP_DOOR.CanCollide = false
VIP_DOOR.Transparency = 0
end
If I am understanding your post right, you want to prompt the purchase for a game pass if the player does not own it? You have to use this: MarketplaceService | Roblox Creator Documentation and MarketplaceService | Roblox Creator Documentation
Just
local MPS = game:GetService("MarketplaceService")
local Door = script.Parent
local GamepassID = 18204949
Door.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
print("Found a valid player")
if MPS:UserOwnsGamePassAsync(Player.UserId, GamepassID) then
print("Player owns pass")
DoorPart.CanCollide = false
else
print("Player does not own pass")
DoorPart.CanCollide = true
MPS:PromptGamepassPurchase(Player, GamepassID)
end
end
end)
Also don’t use a LocalScript
as exploiters could just easily bypass the VIP check, use a Server Script inside the VIP Door for it to detect
I see you watched Ro-scripter. I watched that video as well. Anyways, simply use a touched event like @JackscarIitt said (he knows his stuff).
ok so I put it in a script and I got this error
!
I did a dumb thing, I made DoorPart
& Door
different variables
Try this one
local MPS = game:GetService("MarketplaceService")
local Door = script.Parent
local GamepassID = 18204949
Door.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
print("Found a valid player")
if MPS:UserOwnsGamePassAsync(Player.UserId, GamepassID) then
print("Player owns pass")
Door.CanCollide = false
else
print("Player does not own pass")
Door.CanCollide = true
MPS:PromptGamePassPurchase(Player, GamepassID)
end
end
end)
ok now it lets my main thought because it owns the game pass and does not let my alt in so that part is working. (I am testing in Roblox studio) it does not prompt the purchases thought
I swear if it was cause of a typo
Can you try the script again? I edited it
ok now it works and prompts the purches screen
That’s good, are there any errors or issues? If not, you should mark the post as a solution if it works fine
forgot to mark it as a solutution
Hi, is there a way to make this so other players cannot sneak through the door?
Just change it to a LocalScript
, and put it inside StarterPlayerScripts
if you want to only detect it from the client-side
Of course you’ll have to reference the Door
variable again to make it work