Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't my wall phase through?

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.

3 comments

0

do you own the gamepass and are there any errors in the output box

0

Yes I do own the gamepass, and the only error is this:

0

17:37:18.481 cloud_4678489627.Script:7: Expected ')' (to close '(' at line 6), got '.'

1 answer

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

1 comment

0

It didn't work. It also gave me an error for line 14, because the "end)" apparently wasn't supposed to exist.

This discussion is preserved as it was. New answers, comments, and votes are closed.