Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

brick that can only be walked through for certain players?

Asked by 5 years ago

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)




0
Do you own the gamepass? If not then that might be the problem. If yes, then I'll look for a solution. Bilinearly 58 — 5y
0
Okay I realized that a LocalScript only works on certain objects. Use a normal Script. Bilinearly 58 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

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.

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? retracee 68 — 5y
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 tictac67 96 — 5y
0
i figured it out just now, i would need to use a remote event retracee 68 — 5y
Ad

Answer this question