Ad
Log in to vote
1

Why isn't my wall phase through?

Asked by 22 days ago
Edited 22 days ago

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.

0
do you own the gamepass and are there any errors in the output box JustinWe12 723 — 22d
0
Yes I do own the gamepass, and the only error is this: connafonna 5 — 22d
0
17:37:18.481 cloud_4678489627.Script:7: Expected ')' (to close '(' at line 6), got '.' connafonna 5 — 22d

1 answer

Log in to vote
0
Answered by 22 days ago

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

0
It didn't work. It also gave me an error for line 14, because the "end)" apparently wasn't supposed to exist. connafonna 5 — 22d
Ad

Answer this question