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