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

brick that can only be walked through for certain players?

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)




2 comments

0

Do you own the gamepass? If not then that might be the problem. If yes, then I'll look for a solution.

0

Okay I realized that a LocalScript only works on certain objects. Use a normal Script.

1 answer

✓ Accepted answer

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.

3 comments

0

But if I use a normal script then everyone can get through after the person with the pass gets through. How do you think I could make this work?

0

Maybe add a part on the floor next to it so when they walk in the door they walk over it. You could get that to check if they have the gamepass. If not it kills them

0

i figured it out just now, i would need to use a remote event

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