Premium Door not working?

So, I am trying to make a premium door, you may ask what I mean by a “premium door”.
A premium door is a door that only opens when a player with the premium membership
touches it.

Example: A non-membership player touches the door, but since it has no membership the door
will not open. But if a player with a membership touches the door, it will open.

I am trying to do that but it won’t work, help?

local Players = game:GetService("Players")
local player = Players.LocalPlayer

if player.MembershipType == Enum.MembershipType.Premium then
script.Parent.CanCollide = false
else if player.MembershipType == Enum.MembershipType.None then
script.Parent.CanCollide = true
  1. Where is your script located?

  2. Try print debugging:

A. Put a print(1) at the top of the script
B. Put a print(2) under the first if statement
B. Put a print(3) under the second if statement

Let me know what prints

1 Like

My script is located inside the door itself.

I have tried debugging but nothing prints, no errors as well…

Maybe try this in game?

I have tried this script in-game and in studio but still does not work.
Also what do you mean by “30char”?

1 Like

ignore 30char

also i don’t really think it needs to be a else if because there are only two choices (premium or non-premium)

1 Like

The script doesn’t work because a the local script is located inside of a door, the script is never loaded into any client therefor it does not run, try putting it inside StarterPlayerScripts


It would be wise to use a server script since an exploiter could easily bypass the check.

local door = script.Parent
local Players = game:GetService("Players")

    local player = Players:GetPlayerFromCharacter(part.Parent)

    if player then
        door.CanCollide = player.MembershipType ~= Enum.MembershipType.Premium

It still does not run, no errors whatsoever…

Use a Script, it will run on the server. Never trust the client.

If I were to use a script, where would I place it? Would the script also have to use the same code?

Do like @incapaxx said.

30 Characters

I really don’t think that matters since an exploiter can just turn CanCollide off on their client to get through.


Would the script be in the door? I am a bit confused sorry.

The script would be in the door. You can easily guess the parent of the script from this line

It works but, when a premium player touches it, the can collide turns off right?
This means that a non-premium player can get in with the help of a premium player.
I want this premium door to work alot like the one in “Flex your account age”

In that case you should handle it locally. I’ll use your script slightly modified.

local Players = game:GetService("Players")
local player = Players.LocalPlayer

local door = game.Workspace.PremiumDoorPart -- Put in the right one

door.CanCollide = not (player.MembershipType == Enum.MembershipType.Premium)

This script should be in the StarterPlayerScripts


Now, non premium and premium players can get in despite their memberships.

I made a small edit, can you try again with this version?