Hi, I want to check if a player owns a gamepass, then make a wall phase-through. In testing the game, I don't phase-through the wall. My code is a local script, and the child of the model wall. My code is:
game.Players.PlayerAdded:Connect(function(plr) local ownsgamepass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, 116471196) if ownsgamepass then script.Parent.CanCollide = false else script.Parent.CanCollide = true end end)
What's wrong? I don't think it's an error, because there's no blue or red squiggly line.
Instead of checking Immediately try checking when a player touches the part This is a server script
script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local PlrChar = hit.Parent.Name local Plr = game.Players:FindFirstChild(PlrChar) local ownsGameppass = game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Plr.UserId,116471196) if ownsGameppass then script.Parent.CanCollide = false wait(2) script.Parent.CanCollide = true else script.Parent.CanCollide = true end end end)
I hope this helps