Hello, I'm trying to make an island you need a gamepass to access. When I test it, someone without the gamepass is allowed to pass through. Here is the code.
local Gamepass = 9281869
local Market = game:GetService('MarketplaceService')
part = script.Parent
game.Players.ChildAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if Market:UserOwnsGamePassAsync(player.UserId, Gamepass)then
part.CanCollide = false
else
part.CanCollide = true
end
end)
end)

3 comments
It should be a local script or else the canCollide will change on the server. If you don't know how roblox's servers and clients work here is something you can read: https://developer.roblox.com/en-us/articles/Roblox-Client-Server-Model
Basically, when something happens on a server, it happens to every single client in the server.
If I make it a local script nothing works?