I want a brick that can be walked through if someone has a gamepass and it doesn't work, here's my script (it's a local script)
local PassId = 4835177 local ReplicatedStorage = game:GetService("ReplicatedStorage") local MarketplaceService = game:GetService("MarketplaceService") local getPlayerFromCharacter local player script.Parent.Touched:Connect(function(hit) player = getPlayerFromCharacter(hit.Parent) if MarketplaceService:UserOwnsGamePassAsync(player.UserId, PassId) then script.Parent.CanCollide = false end end)
You might need a Script instead of a LocalScript.
A Script can work on almost everything and can run most functions excluding functions only for LocalScripts and CoreScripts. Accoreing to Roblox Wiki, a LocalScript will work only on selected areas:
A Player's Backpack, such as a child of a Tool A Player's Character model A Player's PlayerGui A Player's PlayerScripts The ReplicatedFirst service
You probably placed your script inside a Part and it will not function at all.