VIP Collision Filtering

Is there a certain way to make a VIP door using game passes allowing player access if they have the game pass using collision filtering on a part?

EDIT I can’t find any information about this and the developer.roblox.com doesn’t really help me much.

1 Like

You can use PhysicsService for this. There’s also a built in feature to check if a player has a certain gamepass.

Yes, Physics service can be used for collision groups to make certain players not collide with the VIP door.

(UserOwnsGamePassAsync to get if they own the gamepass)

You can locally create parts and give them whatever properties you want.

With a local script, you can check if they have the gamepass when they join the game.

If they have the gamepass, the door is created but cancollide is set to false.
If they don’t have the gamepass, the door is created but cancollide is set to true.

Here’s a code example:

-- LocalScript inside StarterPlayerScripts
local MarketPlaceService = game:GetService("MarketPlaceService")

local VipDoor = script:WaitForChild("VipDoor")

local GamepassId = 0

if MarketPlaceService:UserOwnsGamePassAsync(game.Players.LocalPlayer.UserId,GamepassId) then
    VipDoor.CanCollide = false
else
    VipDoor.CanCollide = true
end

VipDoor.Parent = workspace

Otherwise, you could also make it so the door isn’t even placed into workspace if they don’t own the gamepass.

If you don’t like this solution, you could always use PhysicsService as the two people above recommended.

2 Likes

That’s indeed possible with what you are doing, and the PhysicsService solution is more complicated, but it’s possible.

local GamepassService = game:GetService("MarketplaceService")
local PhysicsService = game:GetService("PhysicsService")

local GamepassDoor = workspace:WaitForChild("GamepassDoor")
local Gamepass = 1234567890

local Group = "Owners"
PhysicsService:CreateCollisionGroup(Group)
PhysicsService:CollisionGroupSetCollidable(Group, Group, false)

PhysicsService:SetPartCollisionGroup(GamepassDoor, Group)

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		if GamepassService:UserOwnsGamePassAsync(Player.UserId, Gamepass) then
			for _,v in pairs(Character:GetDescendants()) do
				if v:IsA("BasePart") then
					PhysicsService:SetPartCollisionGroup(v, Group)
				end
			end
		end
	end)
end)

This is basically what OP wants.

8 Likes

I’ve been making use of the fact that changes on the client don’t replicate to the server to create a “DLC” system for a friend’s game

to keep things simple for him, he builds the areas into his map, and my DLCService then instructs the client to delete the parts/terrain (or insert new parts/terrain) if they don’t own the DLC

1 Like

It’s possible that the client could halt the operation before it begins and ignore the server’s instruction to remove parts they shouldn’t see.

Have you considered selective replication where the server only gives the client maps based on eligibility to be there? It’s a hard gamble for loading though, since maps wouldn’t be replicated with their assets downloaded implicitly. You’d have to add that process to a loading screen.

It’s an open world map; however, the DLC removal is triggered by a RemoteFunction within the StarterPlayerScripts folder. It’s not likely to be a very popular game, it’s more just for our amusement. Code in his game is quite badly organised; just designed to work lol. Any successful tests will be more securely and better implemented into games made by my bf and I, and reimplemented into his game. So far, no issues