How do I know if the player is Roblox Premium subscriber?

I’m making a premium only door to my game but IDK what code do I need to write.

You can detect when the player is added.

See this example →

game.Players.PlayerAdded:Connect(function(player)
      if player.MembershipType == Enum.MembershipType.Premium then
              -- [ Do your magic!
      end
end)

You can not only use on PlayerAdded but when a part is Touched, like you did, using the door.

thing.Touched:Connect(function(hit)
      local plr = game.Players:GetPlayerfromCharacter(hit.Parent)
      if plr.MembershipType == Enum.MembershipType.Premium then
             -- [ script..
      end
end)
3 Likes